1
0

Set LUA User data stale and removing pointer references before actual mem deletion of any spell data

This commit is contained in:
Emagi 2024-12-15 08:07:38 -05:00
parent 0a52ab2933
commit 92b8e406e3

View File

@ -1619,9 +1619,13 @@ void LuaInterface::DeletePendingSpells(bool all) {
tmp_deletes.push_back(itr->first); tmp_deletes.push_back(itr->first);
} }
LuaSpell* spell = 0; LuaSpell* spell = 0;
for (del_itr = tmp_deletes.begin(); del_itr != tmp_deletes.end(); del_itr++) { for (del_itr = tmp_deletes.begin(); del_itr != tmp_deletes.end(); del_itr++) {
spell = *del_itr; spell = *del_itr;
SetLuaUserDataStale(spell);
RemoveCurrentSpell(spell->state, spell, false);
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; bool spellDeleted = false;
@ -1654,9 +1658,6 @@ void LuaInterface::DeletePendingSpells(bool all) {
RemoveCustomSpell(spell->spell->GetSpellID()); RemoveCustomSpell(spell->spell->GetSpellID());
safe_delete(spell->spell); safe_delete(spell->spell);
} }
SetLuaUserDataStale(spell);
RemoveCurrentSpell(spell->state, spell, false);
} }
} }
MSpellDelete.unlock(); MSpellDelete.unlock();