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:
1 parent
9b88a789e6
commit
e255d1d376
1 file changed
+11
-9
@@ -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