Crash fix on spell deletion, remove from pending spells if we already plan to delete
This commit is contained in:
parent
aa70c950b8
commit
a6a0ca85ef
@ -1737,7 +1737,6 @@ void LuaInterface::DeletePendingSpells(bool all) {
|
|||||||
|
|
||||||
if(!all) {
|
if(!all) {
|
||||||
// rely on targets the spell->caster could be corrupt
|
// rely on targets the spell->caster could be corrupt
|
||||||
bool spellDeleted = false;
|
|
||||||
if(spell->targets.size() > 0) {
|
if(spell->targets.size() > 0) {
|
||||||
spell->MSpellTargets.readlock(__FUNCTION__, __LINE__);
|
spell->MSpellTargets.readlock(__FUNCTION__, __LINE__);
|
||||||
for (int8 i = 0; i < spell->targets.size(); i++) {
|
for (int8 i = 0; i < spell->targets.size(); i++) {
|
||||||
@ -1748,16 +1747,11 @@ void LuaInterface::DeletePendingSpells(bool all) {
|
|||||||
if(target->IsEntity()) {
|
if(target->IsEntity()) {
|
||||||
((Entity*)target)->RemoveWard(spell);
|
((Entity*)target)->RemoveWard(spell);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!spellDeleted && spell->zone && spell->zone->GetSpellProcess())
|
|
||||||
spell->zone->GetSpellProcess()->DeleteActiveSpell(spell, true);
|
|
||||||
|
|
||||||
spellDeleted = true;
|
|
||||||
}
|
}
|
||||||
spell->MSpellTargets.releasereadlock(__FUNCTION__, __LINE__);
|
spell->MSpellTargets.releasereadlock(__FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!spellDeleted && spell->zone && spell->zone->GetSpellProcess()) {
|
if(spell->zone && spell->zone->GetSpellProcess()) {
|
||||||
spell->zone->GetSpellProcess()->DeleteActiveSpell(spell, true);
|
spell->zone->GetSpellProcess()->DeleteActiveSpell(spell, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3068,8 +3068,11 @@ void SpellProcess::AddSelfAndPetToCharTargets(LuaSpell* spell, Spawn* caster, bo
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SpellProcess::DeleteActiveSpell(LuaSpell* spell, bool skipRemoveCurrent) {
|
void SpellProcess::DeleteActiveSpell(LuaSpell* spell, bool skipRemoveCurrent) {
|
||||||
|
lua_interface->SetLuaUserDataStale(spell);
|
||||||
if(!skipRemoveCurrent)
|
if(!skipRemoveCurrent)
|
||||||
lua_interface->RemoveCurrentSpell(spell->state, spell, true);
|
lua_interface->RemoveCurrentSpell(spell->state, spell, true);
|
||||||
|
|
||||||
|
lua_interface->DeletePendingSpell(spell);
|
||||||
active_spells.Remove(spell, true, 10000);
|
active_spells.Remove(spell, true, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user