Try to avoid deadlock with spell targets
This commit is contained in:
parent
ee4dd24510
commit
3fbe306f51
1 changed files with 8 additions and 3 deletions
|
@ -1998,16 +1998,21 @@ void SpellProcess::RemoveSpellTimersFromSpawn(Spawn* spawn, bool remove_all, boo
|
|||
if (spell->spell->GetSpellData()->persist_through_death)
|
||||
continue;
|
||||
|
||||
bool foundMatch = false;
|
||||
|
||||
spell->MSpellTargets.readlock(__FUNCTION__, __LINE__);
|
||||
for (i = 0; i < spell->targets.size(); i++){
|
||||
if (spawn->GetID() == spell->targets.at(i)){
|
||||
if (spawn->IsEntity())
|
||||
((Entity*)spawn)->RemoveSpellEffect(spell);
|
||||
RemoveTargetFromSpell(spell, spawn, remove_all);
|
||||
foundMatch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
spell->MSpellTargets.releasereadlock(__FUNCTION__, __LINE__);
|
||||
if(foundMatch) {
|
||||
if (spawn->IsEntity())
|
||||
((Entity*)spawn)->RemoveSpellEffect(spell);
|
||||
RemoveTargetFromSpell(spell, spawn, remove_all);
|
||||
}
|
||||
}
|
||||
if(recast_timers.size() > 0 && delete_recast){
|
||||
RecastTimer* recast_timer = 0;
|
||||
|
|
Loading…
Reference in a new issue