Update Unit.cpp

This commit is contained in:
bashermens
2025-12-24 22:01:20 +01:00
committed by GitHub
parent c91ce7f7c2
commit a3b2c7ad0e
+3 -5
View File
@@ -15971,11 +15971,9 @@ 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();
// added for mod_playerbots crash fixes; m_Events.KillAllEvents(false) placed after RemoveFromWorld and // added for mod_playerbots crash fixes; cancel and remove pending events before aura/spellmod cleanup.
// interupt and before RemoveAllAuras. // Without this SpellEvent may be cancelled later during EventProcessor destruction after auras/spellmods
// Cancel and remove pending events (including SpellEvent) before aura/spellmod cleanup. // are already gone leading to invalid access in Player::RestoreSpellMods on logout.
// Without this, SpellEvent may be cancelled later during EventProcessor destruction after auras/spellmods are gone,
// leading to invalid access in Player::RestoreSpellMods on logout.
m_Events.KillAllEvents(false); m_Events.KillAllEvents(false);
ASSERT(GetGUID()); ASSERT(GetGUID());