diff options
author | Trazom62 <none@none> | 2010-05-31 19:19:30 +0200 |
---|---|---|
committer | Trazom62 <none@none> | 2010-05-31 19:19:30 +0200 |
commit | 427e8be65624c9823667429ef2e6a395a1e8f113 (patch) | |
tree | b6428f578e963cb1c40029aa64ab731810cd7851 | |
parent | 15847b2f2f8be359f7d152a9f088c4a4052e9622 (diff) |
Fix Spell::m_selfContainer not reset in destructor. This should fix crash in Unit::FindCurrentSpellBySpellId.
Fixes issue #2263.
--HG--
branch : trunk
-rw-r--r-- | src/game/Spell.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 4986a143247..11c77b8bc69 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -445,6 +445,14 @@ Spell::Spell(Unit* Caster, SpellEntry const *info, bool triggered, uint64 origin Spell::~Spell() { + if (m_referencedFromCurrentSpell && m_selfContainer && *m_selfContainer == this) + { + // Clean the reference to avoid later crash. + // If this error is repeating, we may have to add an assert to better track down how we get into this case. + sLog.outError("SPELL: deleting spell for spell ID %u. However, spell still referenced.", m_spellInfo->Id); + *m_selfContainer = NULL; + } + if (m_caster && m_caster->GetTypeId() == TYPEID_PLAYER) assert(m_caster->ToPlayer()->m_spellModTakingSpell != this); delete m_spellValue; |