From b230e338f8e5a7aab3cbcc596ec6571dc537d9fb Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Wed, 18 Jun 2008 10:07:40 +0200 Subject: [PATCH] Fixed some SIGSEGVs --- bin/ui/psg.scheme | 2 +- src/application.cpp | 26 +++++++++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/bin/ui/psg.scheme b/bin/ui/psg.scheme index 1e19f12..a42d0df 100644 --- a/bin/ui/psg.scheme +++ b/bin/ui/psg.scheme @@ -2,7 +2,7 @@ - + diff --git a/src/application.cpp b/src/application.cpp index b271380..c7813ed 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -144,6 +144,13 @@ private: void Application::go() { + mInputManager = NULL; + mSystem = NULL; + mRenderer = NULL; + mUI = NULL; + mListener = NULL; + mRoot = NULL; + createRoot(); defineResources(); setupRenderSystem(); @@ -157,15 +164,16 @@ void Application::go() { } Application::~Application() { - mInputManager->destroyInputObject(mKeyboard); - mInputManager->destroyInputObject(mMouse); - OIS::InputManager::destroyInputSystem(mInputManager); - - delete mRenderer; - delete mSystem; - delete mUI; - delete mListener; - delete mRoot; + if(mInputManager) { + mInputManager->destroyInputObject(mKeyboard); + mInputManager->destroyInputObject(mMouse); + OIS::InputManager::destroyInputSystem(mInputManager); + } + if(mSystem) delete mSystem; + if(mRenderer) delete mRenderer; + if(mUI) delete mUI; + if(mListener) delete mListener; + if(mRoot) delete mRoot; } void Application::createRoot() { -- 2.11.4.GIT