mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-03-22 15:19:52 +01:00
Fix memory leak
This commit is contained in:
parent
389159728c
commit
a1431b6d2b
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user