fix(Core/Unit): cancel pending events before aura cleanup on map removal (#27527)

Co-authored-by: bashermens <[email protected]>
Co-authored-by: sudlud <[email protected]>
This commit is contained in:
Keleborn
2026-09-07 10:45:17 +02:00
committed by GitHub
co-authored by bashermens sudlud
parent 18f28bd144
commit 2b5ddea71d
+4
View File
@@ -12612,6 +12612,10 @@ void Unit::CleanupBeforeRemoveFromMap(bool finalCleanup)
if (IsInWorld()) // not in world and not being removed atm if (IsInWorld()) // not in world and not being removed atm
RemoveFromWorld(); RemoveFromWorld();
// Abort pending events here: left to ~EventProcessor they run after m_spellMods is already
// destroyed, and cancelling a SpellEvent then hits freed memory in Player::RestoreSpellMods.
m_Events.KillAllEvents(false);
ASSERT(GetGUID()); ASSERT(GetGUID());
// A unit may be in removelist and not in world, but it is still in grid // A unit may be in removelist and not in world, but it is still in grid