fix crash handler deadlock

This commit is contained in:
Glenn Maynard
2004-01-12 01:37:00 +00:00
parent d4c151937e
commit 6ac866c0de
+8 -9
View File
@@ -151,15 +151,6 @@ long __stdcall CrashHandler(EXCEPTION_POINTERS *pExc)
return EXCEPTION_CONTINUE_EXECUTION;
}
/* If we're fullscreen, the fullscreen d3d window will obscure
* the crash dialog. Do this before we suspend threads, or it'll
* deadlock if the thread controlling this window has been stopped. */
/* XXX problem: If the sound thread crashes at the same time the main
* thread tells it to shut down, the main thread will be blocking waiting
* for the sound thread to finish; we'll come here and deadlock waiting for
* it to hide. Hmmmmm. */
ShowWindow( g_hWndMain, SW_HIDE );
RageThread::HaltAllThreads( false );
static bool InHere = false;
@@ -211,6 +202,14 @@ long __stdcall CrashHandler(EXCEPTION_POINTERS *pExc)
* dump, save it now. */
DoSave(pExc);
/* Now things get more risky. If we're fullscreen, the window will obscure the
* crash dialog. Try to hide the window. We stopped threads above; we need to
* resume them now, or ShowWindow will deadlock. Things might blow up here;
* do this after DoSave, so we always write a crash dump. */
RageThread::ResumeAllThreads();
ShowWindow( g_hWndMain, SW_HIDE );
RageThread::HaltAllThreads( false );
if( g_bAutoRestart )
Win32RestartProgram();