Change destruction order - fixes a shutdown crash discovered with mesa

actorid
scrawl 11 years ago
parent def93f9910
commit a3ff9e5be8

@ -42,10 +42,10 @@ int main(int argc, char *argv[])
// TODO: Ogre startup shouldn't be here, but it currently has to: // TODO: Ogre startup shouldn't be here, but it currently has to:
// SceneWidget destructor will delete the created render window, which would be called _after_ Root has shut down :( // SceneWidget destructor will delete the created render window, which would be called _after_ Root has shut down :(
OgreInit::OgreInit ogreInit;
ogreInit.init("./opencsOgre.log"); // TODO log path?
Application mApplication (argc, argv); Application mApplication (argc, argv);
OgreInit::OgreInit ogreInit;
ogreInit.init("./opencsOgre.log"); // TODO log path?
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
QDir dir(QCoreApplication::applicationDirPath()); QDir dir(QCoreApplication::applicationDirPath());

@ -11,6 +11,8 @@
#include <extern/sdl4ogre/sdlwindowhelper.hpp> #include <extern/sdl4ogre/sdlwindowhelper.hpp>
#include <components/ogreinit/ogreinit.hpp>
#include <cassert> #include <cassert>
#include <stdexcept> #include <stdexcept>
@ -23,6 +25,12 @@ void OgreRenderer::cleanup()
delete mFader; delete mFader;
mFader = NULL; mFader = NULL;
Ogre::Root::getSingleton().destroyRenderTarget(mWindow);
mWindow = NULL;
delete mOgreInit;
mOgreInit = NULL;
// If we don't do this, the desktop resolution is not restored on exit // If we don't do this, the desktop resolution is not restored on exit
SDL_SetWindowFullscreen(mSDLWindow, 0); SDL_SetWindowFullscreen(mSDLWindow, 0);
@ -50,7 +58,8 @@ void OgreRenderer::configure(const std::string &logPath,
const std::string& rttMode const std::string& rttMode
) )
{ {
mRoot = mOgreInit.init(logPath + "/ogre.log"); mOgreInit = new OgreInit::OgreInit();
mRoot = mOgreInit->init(logPath + "/ogre.log");
RenderSystem* rs = mRoot->getRenderSystemByName(renderSystem); RenderSystem* rs = mRoot->getRenderSystemByName(renderSystem);
if (rs == 0) if (rs == 0)

@ -9,8 +9,6 @@
#include <OgreTexture.h> #include <OgreTexture.h>
#include <components/ogreinit/ogreinit.hpp>
struct SDL_Window; struct SDL_Window;
struct SDL_Surface; struct SDL_Surface;
@ -26,6 +24,11 @@ namespace Ogre
class ParticleAffectorFactory; class ParticleAffectorFactory;
} }
namespace OgreInit
{
class OgreInit;
}
namespace OEngine namespace OEngine
{ {
namespace Render namespace Render
@ -57,7 +60,7 @@ namespace OEngine
Ogre::Camera *mCamera; Ogre::Camera *mCamera;
Ogre::Viewport *mView; Ogre::Viewport *mView;
OgreInit::OgreInit mOgreInit; OgreInit::OgreInit* mOgreInit;
Fader* mFader; Fader* mFader;

Loading…
Cancel
Save