Skip to content

Commit

Permalink
[10287] Fixed crash in result double deleting auras in some cases.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
VladimirMangos committed Jul 30, 2010
1 parent 76ab23f commit 3648874
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions src/game/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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*/)
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10286"
#define REVISION_NR "10287"
#endif // __REVISION_NR_H__

0 comments on commit 3648874

Please sign in to comment.