1
0

Revert "the destroy spells function was using the wrong mutex locks"

This reverts commit d639e5496156130373ad8f2ddedfe000a5845409.
This commit is contained in:
Emagi 2025-02-08 18:13:06 -05:00
parent a062c5f8d7
commit 65ed5c4f79

View File

@ -143,7 +143,7 @@ void LuaInterface::Process() {
}
void LuaInterface::DestroySpells() {
MSpellScripts.writelock(__FUNCTION__, __LINE__);
MSpells.lock();
map<string, map<lua_State*, LuaSpell*> >::iterator spell_script_itr;
for(spell_script_itr = spell_scripts.begin(); spell_script_itr != spell_scripts.end(); spell_script_itr++) {
map<lua_State*, LuaSpell*>::iterator inner_itr;
@ -166,9 +166,7 @@ void LuaInterface::DestroySpells() {
zone->GetSpellProcess()->CheckRemoveTargetFromSpell(cur_spell, false, true);
}
SetLuaUserDataStale(cur_spell);
MSpells.lock();
RemoveCurrentSpell(inner_itr->first, inner_itr->second, false, true, false);
MSpells.unlock();
lua_close(inner_itr->first);
safe_delete(cur_spell);
MSpellDelete.unlock();
@ -177,13 +175,9 @@ void LuaInterface::DestroySpells() {
Mutex* mutex = GetSpellScriptMutex(spell_script_itr->first.c_str());
safe_delete(mutex);
}
current_spells.clear();
spell_scripts_mutex.clear();
spell_scripts.clear();
MSpellScripts.releasewritelock(__FUNCTION__, __LINE__);
MSpells.lock();
current_spells.clear();
MSpells.unlock();
}