Skip to content

Commit

Permalink
(hopefully) fix silent crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
Artikash committed Mar 2, 2020
1 parent 74b4ae9 commit 49432f6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions GUI/host/exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ namespace

__declspec(noreturn) void Terminate()
{
MessageBoxW(NULL, lastError.c_str(), L"Textractor ERROR", MB_ICONERROR);
abort();
CreateThread(nullptr, 0, [](void* lastError) -> DWORD
{
MessageBoxW(NULL, (wchar_t*)lastError, L"Textractor ERROR", MB_ICONERROR); // might fail to display if called in main thread and exception was in main event loop
abort();
}, lastError.data(), 0, nullptr);
Sleep(MAXDWORD);
}

LONG WINAPI ExceptionLogger(EXCEPTION_POINTERS* exception)
Expand Down

0 comments on commit 49432f6

Please sign in to comment.