We can't throw exceptions except on the main thread.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
#include "RageException.h"
|
#include "RageException.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
|
#include "RageThreads.h"
|
||||||
|
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
|
|
||||||
@@ -13,9 +14,11 @@ using CrashHandler::IsDebuggerPresent;
|
|||||||
using CrashHandler::DebugBreak;
|
using CrashHandler::DebugBreak;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static uint64_t g_HandlerThreadID = RageThread::GetInvalidThreadID();
|
||||||
static void (*g_CleanupHandler)( const RString &sError ) = NULL;
|
static void (*g_CleanupHandler)( const RString &sError ) = NULL;
|
||||||
void RageException::SetCleanupHandler( void (*pHandler)(const RString &sError) )
|
void RageException::SetCleanupHandler( void (*pHandler)(const RString &sError) )
|
||||||
{
|
{
|
||||||
|
g_HandlerThreadID = RageThread::GetCurrentThreadID();
|
||||||
g_CleanupHandler = pHandler;
|
g_CleanupHandler = pHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,6 +54,7 @@ void RageException::Throw( const char *sFmt, ... )
|
|||||||
DebugBreak();
|
DebugBreak();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ASSERT( g_HandlerThreadID == RageThread::GetInvalidThreadID() || g_HandlerThreadID == RageThread::GetCurrentThreadID() );
|
||||||
if( g_CleanupHandler != NULL )
|
if( g_CleanupHandler != NULL )
|
||||||
g_CleanupHandler( error );
|
g_CleanupHandler( error );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user