EmergencyShutdownSDL, moved out of ArchHooks

This commit is contained in:
Glenn Maynard
2004-06-14 17:13:46 +00:00
parent 78ed3f3be6
commit 5cd0e91ea5
+17
View File
@@ -9,6 +9,7 @@
#include "RageUtil.h"
#include "RageSurface.h"
#include "RageSurfaceUtils.h"
#include "RageThreads.h"
#include "StepMania.h"
#include <errno.h>
@@ -335,6 +336,17 @@ void SDL_UpdateHWnd()
#endif
}
#if defined(UNIX)
#include "archutils/Unix/EmergencyShutdown.h"
void EmergencyShutdownSDL()
{
/* Only do this if the main thread crashes; trying to shut down from
* another thread causes crashes (eg. GL may be using TLS). */
if( !strcmp(RageThread::GetCurThreadName(), "Main thread") && SDL_WasInit(SDL_INIT_VIDEO) )
SDL_QuitSubSystem(SDL_INIT_VIDEO);
}
#endif
void SetupSDL()
{
static bool bDone = false;
@@ -347,6 +359,11 @@ void SetupSDL()
/* Clean up on exit. */
atexit( SDL_Quit );
#if defined(UNIX)
/* Attempt to shut down the window on crash. */
RegisterEmergencyShutdownCallback( EmergencyShutdownSDL );
#endif
}
/*