[9776] Set m_mover to NULL on remove SPELL_AURA_MOD_POSSESS by delete.

This should fix a related crash.

Signed-off-by: hunuza <hunuza@gmail.com>
This commit is contained in:
hunuza 2010-04-22 18:48:48 +02:00
parent 7532061a79
commit 1ef89c7a22
3 changed files with 17 additions and 11 deletions

View file

@ -3631,10 +3631,22 @@ void Aura::HandleModPossess(bool apply, bool Real)
} }
else else
{ {
p_caster->InterruptSpell(CURRENT_CHANNELED_SPELL); // the spell is not automatically canceled when interrupted, do it now
p_caster->SetCharm(NULL);
p_caster->SetFarSightGUID(0);
p_caster->SetClientControl(m_target, 0);
p_caster->SetMover(NULL);
p_caster->RemovePetActionBar();
// on delete only do caster related effects
if(m_removeMode == AURA_REMOVE_BY_DELETE)
return;
m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
m_target->SetCharmerGUID(0); m_target->SetCharmerGUID(0);
p_caster->InterruptSpell(CURRENT_CHANNELED_SPELL); // the spell is not automatically canceled when interrupted, do it now
if(m_target->GetTypeId() == TYPEID_PLAYER) if(m_target->GetTypeId() == TYPEID_PLAYER)
{ {
@ -3647,14 +3659,6 @@ void Aura::HandleModPossess(bool apply, bool Real)
m_target->setFaction(cinfo->faction_A); m_target->setFaction(cinfo->faction_A);
} }
p_caster->SetCharm(NULL);
p_caster->SetFarSightGUID(0);
p_caster->SetClientControl(m_target, 0);
p_caster->SetMover(NULL);
p_caster->RemovePetActionBar();
if(m_target->GetTypeId() == TYPEID_UNIT) if(m_target->GetTypeId() == TYPEID_UNIT)
{ {
((Creature*)m_target)->AIM_Initialize(); ((Creature*)m_target)->AIM_Initialize();

View file

@ -4480,7 +4480,9 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
statue = ((Totem*)caster); statue = ((Totem*)caster);
sLog.outDebug("Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode); sLog.outDebug("Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode);
if (mode != AURA_REMOVE_BY_DELETE) // not unapply if target will deleted
// some auras also need to apply modifier (on caster) on remove
if (mode != AURA_REMOVE_BY_DELETE || Aur->GetModifier()->m_auraname == SPELL_AURA_MOD_POSSESS)
Aur->ApplyModifier(false,true); Aur->ApplyModifier(false,true);
if (Aur->_RemoveAura()) if (Aur->_RemoveAura())

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9775" #define REVISION_NR "9776"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__