Controllers should free their callbacks and views

This commit is contained in:
Simon Robertshaw 2012-06-18 16:21:13 +01:00
parent 83ccd65b14
commit 5e301ba17c
10 changed files with 32 additions and 3 deletions

View File

@ -70,6 +70,11 @@ ConsoleView * ConsoleController::GetView()
} }
ConsoleController::~ConsoleController() { ConsoleController::~ConsoleController() {
// TODO Auto-generated destructor stub if(ui::Engine::Ref().GetWindow() == consoleView)
ui::Engine::Ref().CloseWindow();
if(callback)
delete callback;
delete consoleModel;
delete consoleView;
} }

View File

@ -161,6 +161,7 @@ GameController::~GameController()
ui::Engine::Ref().CloseWindow(); ui::Engine::Ref().CloseWindow();
} }
delete gameModel; delete gameModel;
delete gameView;
} }
GameView * GameController::GetView() GameView * GameController::GetView()

View File

@ -130,6 +130,11 @@ void LocalBrowserController::Exit()
} }
LocalBrowserController::~LocalBrowserController() { LocalBrowserController::~LocalBrowserController() {
// TODO Auto-generated destructor stub if(ui::Engine::Ref().GetWindow() == browserView)
ui::Engine::Ref().CloseWindow();
if(callback)
delete callback;
delete localBrowserModel;
delete localBrowserView;
} }

View File

@ -49,5 +49,6 @@ LoginController::~LoginController() {
ui::Engine::Ref().CloseWindow(); ui::Engine::Ref().CloseWindow();
} }
delete loginModel; delete loginModel;
delete loginView;
} }

View File

@ -70,5 +70,8 @@ OptionsController::~OptionsController() {
ui::Engine::Ref().CloseWindow(); ui::Engine::Ref().CloseWindow();
} }
delete model; delete model;
delete view;
if(callback)
delete callback;
} }

View File

@ -103,5 +103,8 @@ PreviewController::~PreviewController() {
ui::Engine::Ref().CloseWindow(); ui::Engine::Ref().CloseWindow();
} }
delete previewModel; delete previewModel;
delete previewView;
if(callback)
delete callback;
} }

View File

@ -64,5 +64,6 @@ RenderController::~RenderController() {
if(callback) if(callback)
delete callback; delete callback;
delete renderModel; delete renderModel;
delete renderView;
} }

View File

@ -89,6 +89,7 @@ SearchController::~SearchController()
ui::Engine::Ref().CloseWindow(); ui::Engine::Ref().CloseWindow();
} }
delete searchModel; delete searchModel;
delete searchView;
} }
void SearchController::DoSearch(std::string query) void SearchController::DoSearch(std::string query)

View File

@ -51,5 +51,9 @@ void SSaveController::Exit()
SSaveController::~SSaveController() { SSaveController::~SSaveController() {
if(ui::Engine::Ref().GetWindow() == ssaveView) if(ui::Engine::Ref().GetWindow() == ssaveView)
ui::Engine::Ref().CloseWindow(); ui::Engine::Ref().CloseWindow();
delete ssaveModel;
delete ssaveView;
if(callback)
delete callback;
} }

View File

@ -50,6 +50,11 @@ void TagsController::Exit()
} }
TagsController::~TagsController() { TagsController::~TagsController() {
// TODO Auto-generated destructor stub if(ui::Engine::Ref().GetWindow() == tagsView)
ui::Engine::Ref().CloseWindow();
delete tagsModel;
delete tagsView;
if(callback)
delete callback;
} }