Fix memory leak
This commit is contained in:
parent
389159728c
commit
a1431b6d2b
@ -239,6 +239,7 @@ void GameController::HistoryRestore()
|
|||||||
if (historyPosition == history.size())
|
if (historyPosition == history.size())
|
||||||
{
|
{
|
||||||
Snapshot * newSnap = gameModel->GetSimulation()->CreateSnapshot();
|
Snapshot * newSnap = gameModel->GetSimulation()->CreateSnapshot();
|
||||||
|
delete gameModel->GetRedoHistory();
|
||||||
gameModel->SetRedoHistory(newSnap);
|
gameModel->SetRedoHistory(newSnap);
|
||||||
}
|
}
|
||||||
Snapshot * snap = history[newHistoryPosition];
|
Snapshot * snap = history[newHistoryPosition];
|
||||||
@ -271,6 +272,8 @@ void GameController::HistorySnapshot()
|
|||||||
history.push_back(newSnap);
|
history.push_back(newSnap);
|
||||||
gameModel->SetHistory(history);
|
gameModel->SetHistory(history);
|
||||||
gameModel->SetHistoryPosition(std::min((size_t)historyPosition+1, history.size()));
|
gameModel->SetHistoryPosition(std::min((size_t)historyPosition+1, history.size()));
|
||||||
|
delete gameModel->GetRedoHistory();
|
||||||
|
gameModel->SetRedoHistory(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user