diff options
author | sogladev <sogladev@gmail.com> | 2025-09-25 14:55:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-25 09:55:30 -0300 |
commit | 80e9265222d964e5371f5968216f07fd5a5eae49 (patch) | |
tree | d621382cf3af57e09d2ec3d92fbf69d9b9151612 /src/server/game/Spells/SpellInfo.cpp | |
parent | d05213d85e64de06562eae2c64eb5d874947064d (diff) |
Revert "fix(Core/Conditions): `ConditionList` use after free (#23006)" (#23023)
Diffstat (limited to 'src/server/game/Spells/SpellInfo.cpp')
-rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 58c20660b9..64a25a2b4a 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -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) |