diff --git a/GUI/host/exception.cpp b/GUI/host/exception.cpp index 9215f9d..4bd8787 100644 --- a/GUI/host/exception.cpp +++ b/GUI/host/exception.cpp @@ -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)