diff options
-rw-r--r-- | src/game/Player.cpp | 5 | ||||
-rw-r--r-- | src/game/Unit.cpp | 28 |
2 files changed, 16 insertions, 17 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 38e3f903778..668434825b4 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -511,10 +511,7 @@ void Player::CleanupsBeforeDelete() TradeCancel(false); DuelComplete(DUEL_INTERUPTED); - if(IsInWorld()) // only for fully created Object - { - Unit::CleanupsBeforeDelete(); - } + Unit::CleanupsBeforeDelete(); if (m_transport) m_transport->RemovePassenger(this); 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() |