diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index a771eb12e..266362f9b 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -112,6 +112,8 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const RenderingManager::~RenderingManager () { + mRendering.removeWindowEventListener(this); + delete mPlayer; delete mSkyManager; delete mDebugging; diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index b4486a0ca..dc9e1fbee 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -114,6 +114,9 @@ Water::~Water() { MeshManager::getSingleton().remove("water"); + if (mReflectionTarget) + mReflectionTexture->getBuffer()->getRenderTarget()->removeListener(this); + mWaterNode->detachObject(mWater); mSceneManager->destroyEntity(mWater); mSceneManager->destroySceneNode(mWaterNode); diff --git a/libs/openengine/ogre/renderer.cpp b/libs/openengine/ogre/renderer.cpp index fadfa8d8c..7c0f88bd7 100644 --- a/libs/openengine/ogre/renderer.cpp +++ b/libs/openengine/ogre/renderer.cpp @@ -156,6 +156,11 @@ void OgreRenderer::setWindowEventListener(Ogre::WindowEventListener* listener) Ogre::WindowEventUtilities::addWindowEventListener(mWindow, listener); } +void OgreRenderer::removeWindowEventListener(Ogre::WindowEventListener* listener) +{ + Ogre::WindowEventUtilities::removeWindowEventListener(mWindow, listener); +} + void OgreRenderer::setFov(float fov) { mCamera->setFOVy(Degree(fov)); diff --git a/libs/openengine/ogre/renderer.hpp b/libs/openengine/ogre/renderer.hpp index f188e2051..f1520a3db 100644 --- a/libs/openengine/ogre/renderer.hpp +++ b/libs/openengine/ogre/renderer.hpp @@ -106,6 +106,7 @@ namespace OEngine ~OgreRenderer() { cleanup(); } void setWindowEventListener(Ogre::WindowEventListener* listener); + void removeWindowEventListener(Ogre::WindowEventListener* listener); /** Configure the renderer. This will load configuration files and set up the Root and logging classes. */