Fix unhandled exceptions giving the "abnormal program termination"
dialog instead of the crash handler.
This commit is contained in:
+15
-10
@@ -819,7 +819,8 @@ int main(int argc, char* argv[])
|
|||||||
CString g_sErrorString = "";
|
CString g_sErrorString = "";
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
try{
|
try { /* RageException */
|
||||||
|
try { /* exception */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ChangeToDirOfExecutable(argv[0]);
|
ChangeToDirOfExecutable(argv[0]);
|
||||||
@@ -977,17 +978,9 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
catch( const RageException &e )
|
catch( const RageException &e )
|
||||||
{
|
{
|
||||||
|
/* Gracefully shut down. */
|
||||||
g_sErrorString = e.what();
|
g_sErrorString = e.what();
|
||||||
}
|
}
|
||||||
catch( const exception &e )
|
|
||||||
{
|
|
||||||
if( LOG )
|
|
||||||
LOG->Warn("Unhandled exception: \"%s\"", e.what() );
|
|
||||||
|
|
||||||
/* Re-throw, so we get an unhandled exception crash and get a backtrace (at least
|
|
||||||
* in Windows). */
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SAFE_DELETE( SCREENMAN );
|
SAFE_DELETE( SCREENMAN );
|
||||||
@@ -1018,6 +1011,18 @@ int main(int argc, char* argv[])
|
|||||||
SAFE_DELETE( FILEMAN );
|
SAFE_DELETE( FILEMAN );
|
||||||
SAFE_DELETE( LOG );
|
SAFE_DELETE( LOG );
|
||||||
|
|
||||||
|
#ifndef DEBUG
|
||||||
|
}
|
||||||
|
catch( const exception &e )
|
||||||
|
{
|
||||||
|
/* This can be things like calling std::string::reserve(-1), or out of memory.
|
||||||
|
* This can happen even as we're shutting things down above, and we make no
|
||||||
|
* attempt to gracefully shut down if it happens--get a crash dump. */
|
||||||
|
CHECKPOINT_M( e.what() );
|
||||||
|
*(char*)0=0; /* crash */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if( g_sErrorString != "" )
|
if( g_sErrorString != "" )
|
||||||
{
|
{
|
||||||
if( g_bAutoRestart )
|
if( g_bAutoRestart )
|
||||||
|
|||||||
Reference in New Issue
Block a user