From 05a5ff02d1af45724f240702380f1802fa559c4a Mon Sep 17 00:00:00 2001 From: SoftCoder Date: Thu, 2 Jun 2016 12:07:01 -0700 Subject: [PATCH] - another attempt to fix issue# 111 --- source/glest_game/main/main.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index e8710631..f1eb6e16 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -127,7 +127,7 @@ static FileCRCPreCacheThread *preCacheThread = NULL; #ifdef WIN32 static string runtimeErrorMsg = ""; // keeps in scope for duration of the application -auto_ptr winSockManager(new SocketManager()); +SocketManager *winSockManager = NULL; #endif @@ -5965,14 +5965,26 @@ __try { #endif initSpecialStrings(); + int result = 0; + try { +#ifdef WIN32 + winSockManager = new SocketManager(); +#endif IRCThread::setGlobalCacheContainerName(GameConstants::ircClientCacheLookupKey); - int result = glestMain(argc, argv); + result = glestMain(argc, argv); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); cleanupProcessObjects(); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - + } + catch(const exception &e) { +#ifdef WIN32 + delete winSockManager; + winSockManager = NULL; +#endif + throw e; + } if(sdl_quitCalled == false) { sdl_quitCalled = true; SDL_Quit();