avoid a lockup condition due to already locked mutexes
This commit is contained in:
parent
b848f78f41
commit
6b73d3617a
@ -1615,7 +1615,7 @@ void LuaInterface::DeletePendingSpells(bool all) {
|
|||||||
|
|
||||||
if(!all) {
|
if(!all) {
|
||||||
if (spell->caster && spell->caster->GetZone()) {
|
if (spell->caster && spell->caster->GetZone()) {
|
||||||
spell->caster->GetZone()->GetSpellProcess()->DeleteActiveSpell(spell);
|
spell->caster->GetZone()->GetSpellProcess()->DeleteActiveSpell(spell, true);
|
||||||
}
|
}
|
||||||
else if(spell->targets.size() > 0 && spell->caster && spell->caster->GetZone()) {
|
else if(spell->targets.size() > 0 && spell->caster && spell->caster->GetZone()) {
|
||||||
spell->MSpellTargets.readlock(__FUNCTION__, __LINE__);
|
spell->MSpellTargets.readlock(__FUNCTION__, __LINE__);
|
||||||
@ -1623,7 +1623,7 @@ void LuaInterface::DeletePendingSpells(bool all) {
|
|||||||
Spawn* target = spell->caster->GetZone()->GetSpawnByID(spell->targets.at(i));
|
Spawn* target = spell->caster->GetZone()->GetSpawnByID(spell->targets.at(i));
|
||||||
if (!target || !target->IsEntity())
|
if (!target || !target->IsEntity())
|
||||||
continue;
|
continue;
|
||||||
target->GetZone()->GetSpellProcess()->DeleteActiveSpell(spell);
|
target->GetZone()->GetSpellProcess()->DeleteActiveSpell(spell, true);
|
||||||
}
|
}
|
||||||
spell->MSpellTargets.releasereadlock(__FUNCTION__, __LINE__);
|
spell->MSpellTargets.releasereadlock(__FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
@ -3026,7 +3026,8 @@ void SpellProcess::AddSelfAndPetToCharTargets(LuaSpell* spell, Spawn* caster, bo
|
|||||||
spell->char_id_targets.insert(make_pair(charID, 0x00));
|
spell->char_id_targets.insert(make_pair(charID, 0x00));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellProcess::DeleteActiveSpell(LuaSpell* spell) {
|
void SpellProcess::DeleteActiveSpell(LuaSpell* spell, bool skipRemoveCurrent) {
|
||||||
|
if(!skipRemoveCurrent)
|
||||||
lua_interface->RemoveCurrentSpell(spell->state, spell, true);
|
lua_interface->RemoveCurrentSpell(spell->state, spell, true);
|
||||||
active_spells.Remove(spell, true, 2000);
|
active_spells.Remove(spell, true, 2000);
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ public:
|
|||||||
void AddActiveSpell(LuaSpell* spell);
|
void AddActiveSpell(LuaSpell* spell);
|
||||||
static void AddSelfAndPet(LuaSpell* spell, Spawn* self, bool onlyPet=false);
|
static void AddSelfAndPet(LuaSpell* spell, Spawn* self, bool onlyPet=false);
|
||||||
static void AddSelfAndPetToCharTargets(LuaSpell* spell, Spawn* caster, bool onlyPet=false);
|
static void AddSelfAndPetToCharTargets(LuaSpell* spell, Spawn* caster, bool onlyPet=false);
|
||||||
void DeleteActiveSpell(LuaSpell* spell);
|
void DeleteActiveSpell(LuaSpell* spell, bool skipRemoveCurrent = false);
|
||||||
static bool AddLuaSpellTarget(LuaSpell* lua_spell, int32 id, bool lock_spell_targets = true);
|
static bool AddLuaSpellTarget(LuaSpell* lua_spell, int32 id, bool lock_spell_targets = true);
|
||||||
mutable std::shared_mutex MSpellProcess;
|
mutable std::shared_mutex MSpellProcess;
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user