fixed overlay singleton

loadfix
Marc Zinnschlag 10 years ago
parent ba46bcad40
commit 8a05c0e5c0

@ -20,7 +20,8 @@
#include "model/world/data.hpp"
CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
: mUserSettings (mCfgMgr), mDocumentManager (mCfgMgr), mViewManager (mDocumentManager),
: mUserSettings (mCfgMgr), mOverlaySystem (0), mDocumentManager (mCfgMgr),
mViewManager (mDocumentManager),
mIpcServerName ("org.openmw.OpenCS"), mServer(NULL), mClientSocket(NULL)
{
std::pair<Files::PathContainer, std::vector<std::string> > config = readConfig();
@ -32,6 +33,8 @@ CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
ogreInit.init ((mCfgMgr.getUserConfigPath() / "opencsOgre.log").string());
mOverlaySystem.reset (new CSVRender::OverlaySystem);
Bsa::registerResources (Files::Collections (config.first, !mFsStrict), config.second, true,
mFsStrict);
@ -66,9 +69,7 @@ CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
}
CS::Editor::~Editor ()
{
CSVRender::OverlaySystem::instance().destroy(); // destruct before Ogre::Root
}
{}
void CS::Editor::setupDataFiles (const Files::PathContainer& dataDirs)
{

@ -43,7 +43,7 @@ namespace CS
Nif::Cache mNifCache;
Files::ConfigurationManager mCfgMgr;
CSMSettings::UserSettings mUserSettings;
CSVRender::OverlaySystem mOverlaySystem;
std::auto_ptr<CSVRender::OverlaySystem> mOverlaySystem;
CSMDoc::DocumentManager mDocumentManager;
CSVDoc::ViewManager mViewManager;
CSVDoc::StartupDialogue mStartup;

@ -1,20 +1,22 @@
#include "overlaysystem.hpp"
#include <cassert>
#include <OgreOverlaySystem.h>
namespace CSVRender
{
OverlaySystem *OverlaySystem::mOverlaySystemInstance = 0;
OverlaySystem::OverlaySystem() : mOverlaySystem(NULL)
OverlaySystem::OverlaySystem()
{
assert(!mOverlaySystemInstance);
mOverlaySystemInstance = this;
mOverlaySystem = new Ogre::OverlaySystem();
}
OverlaySystem::~OverlaySystem()
{
if(mOverlaySystem)
delete mOverlaySystem;
}
@ -26,15 +28,7 @@ namespace CSVRender
Ogre::OverlaySystem *OverlaySystem::get()
{
if(!mOverlaySystem)
mOverlaySystem = new Ogre::OverlaySystem();
return mOverlaySystem;
}
void OverlaySystem::destroy()
{
delete mOverlaySystem;
mOverlaySystem = NULL;
}
}

@ -20,7 +20,6 @@ namespace CSVRender
static OverlaySystem &instance();
Ogre::OverlaySystem *get();
void destroy();
};
}

Loading…
Cancel
Save