(hopefully) fix silent crashes

This commit is contained in:
Akash Mozumdar 2020-03-01 23:41:27 -07:00
parent 74b4ae9da5
commit 49432f689d

View File

@ -22,8 +22,12 @@ namespace
__declspec(noreturn) void Terminate() __declspec(noreturn) void Terminate()
{ {
MessageBoxW(NULL, lastError.c_str(), L"Textractor ERROR", MB_ICONERROR); 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(); abort();
}, lastError.data(), 0, nullptr);
Sleep(MAXDWORD);
} }
LONG WINAPI ExceptionLogger(EXCEPTION_POINTERS* exception) LONG WINAPI ExceptionLogger(EXCEPTION_POINTERS* exception)