From ff68567397e212ce0dda0b2e5b1507aafb4aee15 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 21 Dec 2003 09:14:05 +0000 Subject: [PATCH] Fix unhandled exceptions giving the "abnormal program termination" dialog instead of the crash handler. --- stepmania/src/StepMania.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 6eb45a3655..91a76c1537 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -819,7 +819,8 @@ int main(int argc, char* argv[]) CString g_sErrorString = ""; #ifndef DEBUG - try{ + try { /* RageException */ + try { /* exception */ #endif ChangeToDirOfExecutable(argv[0]); @@ -977,17 +978,9 @@ int main(int argc, char* argv[]) } catch( const RageException &e ) { + /* Gracefully shut down. */ 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 SAFE_DELETE( SCREENMAN ); @@ -1017,6 +1010,18 @@ int main(int argc, char* argv[]) SAFE_DELETE( DISPLAY ); SAFE_DELETE( FILEMAN ); 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 != "" ) {