Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Nov 14, 2016
1 parent 3891597 commit a1431b6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/gui/game/GameController.cpp
Expand Up @@ -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];
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit a1431b6

Please sign in to comment.