1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

Fix possibly hanging pointer to deleted CGObjectInstance

Was stored by CRemoveObjectOperation and accessed on destruction even
though it has been removed by the game
This commit is contained in:
Ivan Savenko 2024-05-13 16:19:14 +00:00
parent f8e4e41c39
commit 62b564650d

View File

@ -126,6 +126,9 @@ std::unique_ptr<CMap> CMapGenerator::generate()
fillZones();
//updated guarded tiles will be calculated in CGameState::initMapObjects()
map->getZones().clear();
// undo manager keeps pointers to object that might be removed during gameplay. Remove them to prevent any hanging pointer after gameplay
map->getEditManager()->getUndoManager().clearAll();
}
catch (rmgException &e)
{