From 1d0ac3b4df9b0e71f63020755457a78b24a13f9a Mon Sep 17 00:00:00 2001 From: cc9cii Date: Wed, 15 Oct 2014 07:02:19 +1100 Subject: [PATCH] Delete Ogre::OverlaySystem before Ogre::Root --- apps/opencs/editor.cpp | 6 ++++++ apps/opencs/editor.hpp | 1 + apps/opencs/view/render/overlaysystem.hpp | 7 ++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 63406cb86..8007207aa 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -18,6 +18,7 @@ #include "model/doc/document.hpp" #include "model/world/data.hpp" +#include "view/render/overlaysystem.hpp" CS::Editor::Editor (OgreInit::OgreInit& ogreInit) : mUserSettings (mCfgMgr), mDocumentManager (mCfgMgr), mViewManager (mDocumentManager), @@ -65,6 +66,11 @@ CS::Editor::Editor (OgreInit::OgreInit& ogreInit) this, SLOT (createNewGame (const boost::filesystem::path&))); } +CS::Editor::~Editor () +{ + CSVRender::OverlaySystem::instance().destroy(); // destruct before Ogre::Root +} + void CS::Editor::setupDataFiles (const Files::PathContainer& dataDirs) { for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter) diff --git a/apps/opencs/editor.hpp b/apps/opencs/editor.hpp index c87e24e77..88479f68c 100644 --- a/apps/opencs/editor.hpp +++ b/apps/opencs/editor.hpp @@ -64,6 +64,7 @@ namespace CS public: Editor (OgreInit::OgreInit& ogreInit); + ~Editor (); bool makeIPCServer(); void connectToIPCServer(); diff --git a/apps/opencs/view/render/overlaysystem.hpp b/apps/opencs/view/render/overlaysystem.hpp index 64f95975e..087d414ff 100644 --- a/apps/opencs/view/render/overlaysystem.hpp +++ b/apps/opencs/view/render/overlaysystem.hpp @@ -14,7 +14,7 @@ namespace CSVRender } ~OverlaySystem() { - delete mOverlaySystem; + if(mOverlaySystem) delete mOverlaySystem; } OverlaySystem(OverlaySystem const&); @@ -30,6 +30,11 @@ namespace CSVRender Ogre::OverlaySystem *get() { return mOverlaySystem; } + + void destroy() { + delete mOverlaySystem; + mOverlaySystem = NULL; + } }; }