Update src/server/game/Maps/Map.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
天鹭 2025-10-11 16:04:45 +08:00 committed by GitHub
parent f3fc1b6e49
commit 052d8b1cae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,6 +54,8 @@ Map::~Map()
{
// UnloadAll must be called before deleting the map
// Kill all scheduled events without executing them, since the map and its objects are being destroyed.
// This prevents events from running on invalid or deleted objects during map destruction.
m_Events.KillAllEvents(false);
sScriptMgr->OnDestroyMap(this);