mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +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:
@@ -126,6 +126,9 @@ std::unique_ptr<CMap> CMapGenerator::generate()
|
|||||||
fillZones();
|
fillZones();
|
||||||
//updated guarded tiles will be calculated in CGameState::initMapObjects()
|
//updated guarded tiles will be calculated in CGameState::initMapObjects()
|
||||||
map->getZones().clear();
|
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)
|
catch (rmgException &e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user