aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-04-03 14:51:40 -0600
committermegamage <none@none>2009-04-03 14:51:40 -0600
commitc48ea87a035127ede390e6c461ecbd213bf3b7e0 (patch)
tree6322006d040c5cf04aa8cf99a9489d52924263a3 /src/game/Unit.cpp
parent2bc033a328b68231f84ea8beca972572ecc1a75d (diff)
*Fix some crash when unit is removed.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 7e64c9617d9..3df54dfe6c7 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -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()