From cb5b56785fe8b57645b159c519cb41301a67e25d Mon Sep 17 00:00:00 2001 From: QAston Date: Sun, 12 Apr 2009 17:53:05 +0200 Subject: Try to fix some aura update related crashes. --HG-- branch : trunk --- src/game/SpellAuras.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/game') diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 955539b4c53..a52d9b81634 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -764,16 +764,19 @@ void AreaAuraEffect::Update(uint32 diff) } else // aura at non-caster { - Unit * tmp_target = m_target; + // WARNING: the aura may get deleted during the update + // DO NOT access its members after update! + AuraEffect::Update(diff); + + // Speedup - no need to do more checks + if (GetParentAura()->IsRemoved()) + return; + Unit* caster = GetCaster(); uint32 tmp_spellId = GetId(); uint32 tmp_effIndex = GetEffIndex(); uint64 tmp_guid = GetCasterGUID(); - // WARNING: the aura may get deleted during the update - // DO NOT access its members after update! - AuraEffect::Update(diff); - // remove aura if out-of-range from caster (after teleport for example) // or caster is isolated or caster no longer has the aura // or caster is (no longer) friendly @@ -841,7 +844,10 @@ void PersistentAreaAuraEffect::Update(uint32 diff) remove = true; if(remove) + { m_target->RemoveAura(GetParentAura()); + return; + } AuraEffect::Update(diff); } -- cgit v1.2.3