From 294f449c2f2819971ce9528c9557fc3be8cd4ed1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 17 Aug 2014 14:58:51 +0300 Subject: Move windows deletion into windowmanager. --- src/client.cpp | 10 +--------- src/gui/windowmanager.cpp | 13 +++++++++++++ src/gui/windowmanager.h | 2 ++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index 342f24f14..c52468563 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -601,14 +601,7 @@ void Client::gameClear() config.removeListeners(this); eventsManager.shutdown(); - - delete2(setupWindow); - delete2(helpWindow); - delete2(didYouKnowWindow); - delete2(commandHandler); - delete2(popupMenu); - delete2(beingPopup); - delete2(textPopup); + WindowManager::deleteWindows(); stopTimers(); @@ -694,7 +687,6 @@ void Client::gameClear() if (logger) logger->log1("Quitting9"); - delete2(userPalette); delete2(joystick); keyboard.deinit(); diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index ff060594c..d96d632f0 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -42,6 +42,7 @@ #include "gui/widgets/desktop.h" +#include "utils/delete2.h" #include "utils/files.h" #include "utils/sdlcheckutils.h" #include "utils/sdlhelper.h" @@ -104,6 +105,18 @@ void WindowManager::createWindows() textPopup->postInit(); } +void WindowManager::deleteWindows() +{ + delete2(textPopup); + delete2(beingPopup); + delete2(popupMenu); + delete2(commandHandler); + delete2(didYouKnowWindow); + delete2(helpWindow); + delete2(setupWindow); + delete2(userPalette); +} + void WindowManager::initTitle() { if (settings.options.test.empty()) diff --git a/src/gui/windowmanager.h b/src/gui/windowmanager.h index 26b07e410..46756f954 100644 --- a/src/gui/windowmanager.h +++ b/src/gui/windowmanager.h @@ -63,6 +63,8 @@ namespace WindowManager void createWindows(); + void deleteWindows(); + void initTitle(); void setIcon(); -- cgit v1.2.3-70-g09d2