Apply some fixes to server destruction order

was broken by bc4ab8b99e8a9530f2a53152ff03608e278b4351
This commit is contained in:
sfan5 2024-09-27 19:04:59 +02:00
parent d6da80fe24
commit 9e14f5f053

@ -393,6 +393,10 @@ Server::~Server()
infostream << "Server: Saving environment metadata" << std::endl; infostream << "Server: Saving environment metadata" << std::endl;
m_env->saveMeta(); 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. // Note that this also deletes and saves the map.
delete m_env; delete m_env;
m_env = nullptr; 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 the rest in the reverse order of creation
delete m_game_settings; delete m_game_settings;
delete m_banmanager; delete m_banmanager;