From 05f5061c1952eb1aef59385685cc06dea59722b6 Mon Sep 17 00:00:00 2001 From: Emagi Date: Sun, 17 Aug 2025 18:18:29 -0400 Subject: [PATCH] don't allow zone to shutdown while spawn process takes place, check by using MMasterSpawnLock first --- source/WorldServer/zoneserver.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/WorldServer/zoneserver.cpp b/source/WorldServer/zoneserver.cpp index 0b17a9e..4aadeb9 100644 --- a/source/WorldServer/zoneserver.cpp +++ b/source/WorldServer/zoneserver.cpp @@ -191,11 +191,15 @@ ZoneServer::ZoneServer(const char* name) { typedef map ChangedSpawnMapType; ZoneServer::~ZoneServer() { lua_interface->DeletePendingSpells(true, this); + + MMasterSpawnLock.writelock(__FUNCTION__, __LINE__); zoneShuttingDown = true; //ensure other threads shut down too //allow other threads to properly shut down + if(is_initialized) { LogWrite(ZONE__INFO, 0, "Zone", "Initiating zone shutdown of '%s'", zone_name); } + MMasterSpawnLock.releasewritelock(__FUNCTION__, __LINE__); int32 disp_count = 0; int32 next_disp_count = 100; while (spawnthread_active || initial_spawn_threads_active > 0){