mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-10 18:34:21 +02:00
Fix memory leak
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user