[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.
This commit is contained in:
VladimirMangos 2010-07-30 05:00:22 +04:00
parent 119e97a1a1
commit ed737c55cd
2 changed files with 6 additions and 11 deletions

View file

@ -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); 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 // some auras also need to apply modifier (on caster) on remove
if (mode == AURA_REMOVE_BY_DELETE) if (mode == AURA_REMOVE_BY_DELETE)
{ {
@ -4628,22 +4633,12 @@ void Unit::RemoveAura(Aura *Aur, AuraRemoveMode mode)
else else
Aur->ApplyModifier(false,true); Aur->ApplyModifier(false,true);
Aur->GetHolder()->RemoveAura(Aur->GetEffIndex());
// If aura in use (removed from code that plan access to it data after return) // If aura in use (removed from code that plan access to it data after return)
// store it in aura list with delayed deletion // store it in aura list with delayed deletion
if (Aur->IsInUse()) if (Aur->IsInUse())
m_deletedAuras.push_back(Aur); m_deletedAuras.push_back(Aur);
else else
delete Aur; 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*/) void Unit::RemoveAllAuras(AuraRemoveMode mode /*= AURA_REMOVE_BY_DEFAULT*/)

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 "10286" #define REVISION_NR "10287"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__