diff --git a/src/sys_win32.c b/src/sys_win32.c index d7cecc31..6f072732 100644 --- a/src/sys_win32.c +++ b/src/sys_win32.c @@ -2116,14 +2116,17 @@ int CALLBACK wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev_instance, } } - /* Panic message was set */ + /* Check if panicking */ if (atomic_i32_eval(&G.panicking)) { + /* Wait for panic message to be ready */ + WaitForSingleObject(G.panic_event, INFINITE); /* Force stop threads */ for (struct win32_thread *t = G.threads_last; t; t = t->prev) { HANDLE handle = t->handle; TerminateThread(handle, 0); CloseHandle(handle); } + /* Set error and abort */ error_msg = G.panic_wstr; goto abort; }