From 21b8456453242e132c85f92047cf9bce535c1b22 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 20 Feb 2012 21:09:08 +0100 Subject: [PATCH] fixed a double-free that can happen if OpenMW exits prematurely (when OgreRenderer is deleted before CreateScene() was called) --- ogre/renderer.cpp | 3 ++- ogre/renderer.hpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ogre/renderer.cpp b/ogre/renderer.cpp index ccbc4e191..399d50d42 100644 --- a/ogre/renderer.cpp +++ b/ogre/renderer.cpp @@ -13,7 +13,8 @@ using namespace OEngine::Render; void OgreRenderer::cleanup() { - delete mFader; + if (mFader) + delete mFader; if(mRoot) delete mRoot; diff --git a/ogre/renderer.hpp b/ogre/renderer.hpp index 0c2f0d3d1..f48383cbc 100644 --- a/ogre/renderer.hpp +++ b/ogre/renderer.hpp @@ -32,7 +32,7 @@ namespace Render public: OgreRenderer() - : mRoot(NULL), mWindow(NULL), mScene(NULL) {} + : mRoot(NULL), mWindow(NULL), mScene(NULL), mFader(NULL) {} ~OgreRenderer() { cleanup(); } /** Configure the renderer. This will load configuration files and