From 1403a3fe44bcfc373893cdede95dcb5749a50574 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Mon, 16 Apr 2012 15:46:22 +0000 Subject: [PATCH] - fixed a memory leak and fixed a segfault in a thread class --- source/glest_game/global/core_data.cpp | 1 + .../shared_lib/sources/platform/common/simple_threads.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source/glest_game/global/core_data.cpp b/source/glest_game/global/core_data.cpp index 266b69b9..9a8ede4c 100644 --- a/source/glest_game/global/core_data.cpp +++ b/source/glest_game/global/core_data.cpp @@ -387,6 +387,7 @@ void CoreData::load() { menuMusic.open(getGameCustomCoreDataPath(data_path, "data/core/" + menuMusicPath + menuMusicFile)); menuMusic.setNext(&menuMusic); + cleanup(); waterSounds.resize(6); for(int i=0; i<6; ++i){ diff --git a/source/shared_lib/sources/platform/common/simple_threads.cpp b/source/shared_lib/sources/platform/common/simple_threads.cpp index b8eebe9b..92c5a0c8 100644 --- a/source/shared_lib/sources/platform/common/simple_threads.cpp +++ b/source/shared_lib/sources/platform/common/simple_threads.cpp @@ -412,17 +412,19 @@ void SimpleTaskThread::execute() { sleep(this->millisecsBetweenExecutions); } - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s] END\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str()); + mustDeleteSelf = getDeleteSelfOnExecutionDone(); } catch(const exception &ex) { SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s] END\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str()); + mustDeleteSelf = getDeleteSelfOnExecutionDone(); + throw megaglest_runtime_error(ex.what()); } } - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s] END\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str()); - mustDeleteSelf = getDeleteSelfOnExecutionDone(); } if(mustDeleteSelf == true) {