mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-02 23:26:37 +01:00
Core/Transports: Fix possible crash
Fix a crash happening when deleting an instance with transports. This case doesn't appear in current sources but could have happened in ICC and HoR.
This commit is contained in:
@@ -63,15 +63,6 @@ Map::~Map()
|
||||
obj->ResetMap();
|
||||
}
|
||||
|
||||
for (TransportsContainer::iterator itr = _transports.begin(); itr != _transports.end();)
|
||||
{
|
||||
Transport* transport = *itr;
|
||||
++itr;
|
||||
|
||||
transport->RemoveFromWorld();
|
||||
delete transport;
|
||||
}
|
||||
|
||||
if (!m_scriptSchedule.empty())
|
||||
sScriptMgr->DecreaseScheduledScriptCount(m_scriptSchedule.size());
|
||||
|
||||
@@ -1357,6 +1348,17 @@ void Map::UnloadAll()
|
||||
++i;
|
||||
UnloadGrid(grid, true); // deletes the grid and removes it from the GridRefManager
|
||||
}
|
||||
|
||||
for (TransportsContainer::iterator itr = _transports.begin(); itr != _transports.end();)
|
||||
{
|
||||
Transport* transport = *itr;
|
||||
++itr;
|
||||
|
||||
transport->RemoveFromWorld();
|
||||
delete transport;
|
||||
}
|
||||
|
||||
_transports.clear();
|
||||
}
|
||||
|
||||
// *****************************
|
||||
|
||||
Reference in New Issue
Block a user