Only free GameView if it can be closed

This commit is contained in:
Simon Robertshaw
2013-05-06 00:24:53 +01:00
parent fea71ec69b
commit b8b5f91e20

View File

@@ -193,10 +193,6 @@ GameController::~GameController()
{ {
delete options; delete options;
} }
if(ui::Engine::Ref().GetWindow() == gameView)
{
ui::Engine::Ref().CloseWindow();
}
//deleted here because it refuses to be deleted when deleted from gameModel even with the same code //deleted here because it refuses to be deleted when deleted from gameModel even with the same code
std::deque<Snapshot*> history = gameModel->GetHistory(); std::deque<Snapshot*> history = gameModel->GetHistory();
for(std::deque<Snapshot*>::iterator iter = history.begin(), end = history.end(); iter != end; ++iter) for(std::deque<Snapshot*>::iterator iter = history.begin(), end = history.end(); iter != end; ++iter)
@@ -214,8 +210,12 @@ GameController::~GameController()
delete *iter; delete *iter;
} }
delete gameModel; delete gameModel;
if(ui::Engine::Ref().GetWindow() == gameView)
{
ui::Engine::Ref().CloseWindow();
delete gameView; delete gameView;
} }
}
void GameController::HistoryRestore() void GameController::HistoryRestore()
{ {