*Fix some crash when unit is removed.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-04-03 14:51:40 -06:00
parent 2bc033a328
commit c48ea87a03
2 changed files with 16 additions and 17 deletions

View File

@@ -11323,21 +11323,23 @@ void Unit::RemoveFromWorld()
void Unit::CleanupsBeforeDelete()
{
if(IsInWorld()) // only for fully created object
{
RemoveAllAuras();
InterruptNonMeleeSpells(true);
m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
CombatStop();
ClearComboPointHolders();
DeleteThreatList();
getHostilRefManager().setOnlineOfflineState(false);
RemoveAllGameObjects();
RemoveAllDynObjects();
GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
assert(m_uint32Values);
//A unit may be in removelist and not in world, but it is still in grid
//and may have some references during delete
RemoveAllAuras();
InterruptNonMeleeSpells(true);
m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
CombatStop();
ClearComboPointHolders();
DeleteThreatList();
getHostilRefManager().setOnlineOfflineState(false);
RemoveAllGameObjects();
RemoveAllDynObjects();
GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
if(IsInWorld())
RemoveFromWorld();
}
}
void Unit::UpdateCharmAI()