From 9e14f5f0538ed6fbc98ea47de6c132b756eef148 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 27 Sep 2024 19:04:59 +0200 Subject: [PATCH] Apply some fixes to server destruction order was broken by bc4ab8b99e8a9530f2a53152ff03608e278b4351 --- src/server.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/server.cpp b/src/server.cpp index ddafa6312..e57d81dbb 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -393,6 +393,10 @@ Server::~Server() infostream << "Server: Saving environment metadata" << std::endl; m_env->saveMeta(); + // Delete classes that depend on the environment + m_inventory_mgr.reset(); + m_script.reset(); + // Note that this also deletes and saves the map. delete m_env; m_env = nullptr; @@ -409,6 +413,9 @@ Server::~Server() } } + // emerge may depend on definition managers, so destroy first + m_emerge.reset(); + // Delete the rest in the reverse order of creation delete m_game_settings; delete m_banmanager;