Skip to content

Commit 49432f6

Browse files
committed
(hopefully) fix silent crashes
1 parent 74b4ae9 commit 49432f6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

GUI/host/exception.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ namespace
2222

2323
__declspec(noreturn) void Terminate()
2424
{
25-
MessageBoxW(NULL, lastError.c_str(), L"Textractor ERROR", MB_ICONERROR);
26-
abort();
25+
CreateThread(nullptr, 0, [](void* lastError) -> DWORD
26+
{
27+
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
28+
abort();
29+
}, lastError.data(), 0, nullptr);
30+
Sleep(MAXDWORD);
2731
}
2832

2933
LONG WINAPI ExceptionLogger(EXCEPTION_POINTERS* exception)

0 commit comments

Comments
 (0)