From bccf21fbd154f18c64341be8b37ce96dd01c65c6 Mon Sep 17 00:00:00 2001 From: Foe Date: Wed, 20 Nov 2024 00:18:24 +0100 Subject: [PATCH] Delay deletion Eluna state for maps (#6) This ensures all objects on the map has been unloaded properly and their event processor has been deleted. Fixes #5 --- src/game/Maps/Map.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index 46b5c7d6f10..bf5c74dbaab 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -70,9 +70,6 @@ Map::~Map() if (Eluna* e = GetEluna()) if (Instanceable()) e->FreeInstanceId(GetInstanceId()); - - delete eluna; - eluna = nullptr; #endif UnloadAll(true); @@ -98,6 +95,11 @@ Map::~Map() transport->ResetMap(); delete transport; } + +#ifdef BUILD_ELUNA + delete eluna; + eluna = nullptr; +#endif } uint32 Map::GetCurrentMSTime() const