From d3db6a370c9cc76db28fb415928acb239c9e1816 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 22 Jan 2011 01:23:45 +0000 Subject: [PATCH] - attempt to shutdown program and threads on unhandled exceptiosn to avoid bad results (thanks for finding this ElimNator) --- source/glest_game/main/main.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 4f2a3a082..1cd3d49f5 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -152,6 +152,12 @@ void fatal(const char *s, ...) // failure exit } } + // Now try to shutdown threads if possible + Program *program = Program::getInstance(); + delete program; + program = NULL; + // END + exit(EXIT_FAILURE); } @@ -382,6 +388,12 @@ public: #endif message(err); } + + // Now try to shutdown threads if possible + delete program; + program = NULL; + // END + showCursor(true); restoreVideoMode(true); @@ -412,7 +424,13 @@ public: showCursor(true); restoreVideoMode(true); SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s\n",msg); - //SystemFlags::Close(); + + // Now try to shutdown threads if possible + Program *program = Program::getInstance(); + delete program; + program = NULL; + // END + exit(0); } @@ -978,7 +996,7 @@ void setupLogging(Config &config, bool haveSpecialOutputCommandLineOption) { } void runTechValidationReport(int argc, char** argv) { - disableBacktrace=true; + //disableBacktrace=true; printf("====== Started Validation ======\n");