From ed737c55cd107ea9605adb76f04f0c515a8bfc02 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 30 Jul 2010 05:00:22 +0400 Subject: [PATCH] [10287] Fixed crash in result double deleting auras in some cases. Pre-aura holder code always remove auras from diff lists before un-apply aura affect call. Restore this way work for new aura holder code. This prevent different strange affects when aura find by search when it already expected to be removed from target, including case when in result som un-apply called code aura deleted 2 times. --- src/game/Unit.cpp | 15 +++++---------- src/shared/revision_nr.h | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 1d38c35b4..988f82283 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4611,6 +4611,11 @@ void Unit::RemoveAura(Aura *Aur, AuraRemoveMode mode) DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode); + // aura _MUST_ be remove from holder before unapply. + // un-apply code expected that aura not find by diff searches + // in another case it can be double removed for example, if target die/etc in un-apply process. + Aur->GetHolder()->RemoveAura(Aur->GetEffIndex()); + // some auras also need to apply modifier (on caster) on remove if (mode == AURA_REMOVE_BY_DELETE) { @@ -4628,22 +4633,12 @@ void Unit::RemoveAura(Aura *Aur, AuraRemoveMode mode) else Aur->ApplyModifier(false,true); - Aur->GetHolder()->RemoveAura(Aur->GetEffIndex()); - // If aura in use (removed from code that plan access to it data after return) // store it in aura list with delayed deletion if (Aur->IsInUse()) m_deletedAuras.push_back(Aur); else delete Aur; - - - // only way correctly remove all auras from list - /*if( m_Auras.empty() ) - i = m_Auras.end(); - else - i = m_Auras.begin();*/ - } void Unit::RemoveAllAuras(AuraRemoveMode mode /*= AURA_REMOVE_BY_DEFAULT*/) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e857eaf82..4f86007ff 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10286" + #define REVISION_NR "10287" #endif // __REVISION_NR_H__