From 8a93581c8ab457819a258286aca4ef4359d80877 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Fri, 30 Nov 2012 19:41:13 +0200 Subject: [PATCH] Run scriptapi_on_shutdown() thread-safely and remove some old crap --- src/server.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/server.cpp b/src/server.cpp index 67c1ce92..a793c6e2 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1113,11 +1113,16 @@ Server::~Server() } } - /* - Execute script shutdown hooks - */ - scriptapi_on_shutdown(m_lua); - + { + JMutexAutoLock envlock(m_env_mutex); + JMutexAutoLock conlock(m_con_mutex); + + /* + Execute script shutdown hooks + */ + scriptapi_on_shutdown(m_lua); + } + { JMutexAutoLock envlock(m_env_mutex); @@ -1149,14 +1154,6 @@ Server::~Server() i = m_clients.getIterator(); i.atEnd() == false; i++) { - /*// Delete player - // NOTE: These are removed by env destructor - { - u16 peer_id = i.getNode()->getKey(); - JMutexAutoLock envlock(m_env_mutex); - m_env->removePlayer(peer_id); - }*/ - // Delete client delete i.getNode()->getValue(); } -- 2.30.2