From 03ee27cf219d06740eea9567b7bbc8ea282e4e2f Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Fri, 23 Feb 2007 10:25:53 +0000 Subject: [PATCH] We can't throw exceptions except on the main thread. --- stepmania/src/RageException.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stepmania/src/RageException.cpp b/stepmania/src/RageException.cpp index bd791f0b30..493b15195e 100644 --- a/stepmania/src/RageException.cpp +++ b/stepmania/src/RageException.cpp @@ -2,6 +2,7 @@ #include "RageException.h" #include "RageUtil.h" #include "RageLog.h" +#include "RageThreads.h" #include @@ -13,9 +14,11 @@ using CrashHandler::IsDebuggerPresent; using CrashHandler::DebugBreak; #endif +static uint64_t g_HandlerThreadID = RageThread::GetInvalidThreadID(); static void (*g_CleanupHandler)( const RString &sError ) = NULL; void RageException::SetCleanupHandler( void (*pHandler)(const RString &sError) ) { + g_HandlerThreadID = RageThread::GetCurrentThreadID(); g_CleanupHandler = pHandler; } @@ -51,6 +54,7 @@ void RageException::Throw( const char *sFmt, ... ) DebugBreak(); #endif + ASSERT( g_HandlerThreadID == RageThread::GetInvalidThreadID() || g_HandlerThreadID == RageThread::GetCurrentThreadID() ); if( g_CleanupHandler != NULL ) g_CleanupHandler( error );