Permalink
Browse files

Fix memory leak

1 parent 3891597 commit a1431b6d2be81239c16e3ee8348e2d00fbd822db @jacob1 jacob1 committed Nov 14, 2016
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/gui/game/GameController.cpp
@@ -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);
}
}

0 comments on commit a1431b6

Please sign in to comment.