Revert "fix(Core/Conditions): ConditionList use after free (#23006)" (#23023)

This commit is contained in:
sogladev
2025-09-25 14:55:30 +02:00
committed by GitHub
parent d05213d85e
commit 80e9265222
7 changed files with 65 additions and 59 deletions

View File

@@ -863,6 +863,11 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry)
_requireCooldownInfo = false;
}
SpellInfo::~SpellInfo()
{
_UnloadImplicitTargetConditionLists();
}
uint32 SpellInfo::GetCategory() const
{
return CategoryEntry ? CategoryEntry->Id : 0;
@@ -2868,6 +2873,23 @@ bool SpellInfo::_IsPositiveTarget(uint32 targetA, uint32 targetB)
return true;
}
void SpellInfo::_UnloadImplicitTargetConditionLists()
{
// find the same instances of ConditionList and delete them.
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
ConditionList* cur = Effects[i].ImplicitTargetConditions;
if (!cur)
continue;
for (uint8 j = i; j < MAX_SPELL_EFFECTS; ++j)
{
if (Effects[j].ImplicitTargetConditions == cur)
Effects[j].ImplicitTargetConditions = nullptr;
}
delete cur;
}
}
bool SpellInfo::CheckElixirStacking(Unit const* caster) const
{
if (!caster)