diff --git a/source/glest_game/facilities/components.cpp b/source/glest_game/facilities/components.cpp index 2c2e79afd..8f96685f7 100644 --- a/source/glest_game/facilities/components.cpp +++ b/source/glest_game/facilities/components.cpp @@ -46,6 +46,10 @@ GraphicComponent::GraphicComponent(std::string containerName, std::string objNam editable= true; } +void GraphicComponent::clearRegisteredComponents() { + GraphicComponent::registeredGraphicComponentList.clear(); +} + void GraphicComponent::registerGraphicComponent(std::string containerName, std::string objName) { instanceName = objName; registeredGraphicComponentList[containerName][objName] = this; diff --git a/source/glest_game/facilities/components.h b/source/glest_game/facilities/components.h index 584463f09..9f255b7de 100644 --- a/source/glest_game/facilities/components.h +++ b/source/glest_game/facilities/components.h @@ -57,6 +57,7 @@ public: GraphicComponent(std::string containerName="", std::string objName=""); virtual ~GraphicComponent(){} + static void clearRegisteredComponents(); void registerGraphicComponent(std::string containerName, std::string objName); static GraphicComponent * findRegisteredComponent(std::string containerName, std::string objName); static void applyAllCustomProperties(std::string containerName); diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index f84cbd2c1..6f53a41f4 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -32,6 +32,7 @@ #include "menu_state_masterserver.h" #include "checksum.h" #include +#include "sound_renderer.h" #include "leak_dumper.h" #ifndef WIN32 @@ -937,13 +938,14 @@ int glestMain(int argc, char** argv){ SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - //SoundRenderer &soundRenderer= SoundRenderer::getInstance(); - //soundRenderer.stopAllSounds(); - delete mainWindow; SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + GraphicComponent::clearRegisteredComponents(); + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + //SystemFlags::Close(); return 0; diff --git a/source/glest_game/sound/sound_renderer.cpp b/source/glest_game/sound/sound_renderer.cpp index c3a2d9301..1354081e9 100644 --- a/source/glest_game/sound/sound_renderer.cpp +++ b/source/glest_game/sound/sound_renderer.cpp @@ -89,10 +89,9 @@ SoundRenderer::~SoundRenderer(){ stopAllSounds(); + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); + delete soundPlayer; - - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); - soundPlayer = NULL; SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);