Fix memory leak

This commit is contained in:
jacob1 2016-11-14 10:19:49 -05:00
parent 389159728c
commit a1431b6d2b

View File

@ -239,6 +239,7 @@ void GameController::HistoryRestore()
if (historyPosition == history.size())
{
Snapshot * newSnap = gameModel->GetSimulation()->CreateSnapshot();
delete gameModel->GetRedoHistory();
gameModel->SetRedoHistory(newSnap);
}
Snapshot * snap = history[newHistoryPosition];
@ -271,6 +272,8 @@ void GameController::HistorySnapshot()
history.push_back(newSnap);
gameModel->SetHistory(history);
gameModel->SetHistoryPosition(std::min((size_t)historyPosition+1, history.size()));
delete gameModel->GetRedoHistory();
gameModel->SetRedoHistory(NULL);
}
}