diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-11-30 19:41:13 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-11-30 19:41:13 +0200 |
commit | 8a93581c8ab457819a258286aca4ef4359d80877 (patch) | |
tree | c456391c6e4a6f84854388ed15cab121bb30d4de | |
parent | 6c8fa83ecd3f40a8e2fec890caaaa955f9d4255c (diff) | |
download | minetest-8a93581c8ab457819a258286aca4ef4359d80877.tar.gz minetest-8a93581c8ab457819a258286aca4ef4359d80877.tar.bz2 minetest-8a93581c8ab457819a258286aca4ef4359d80877.zip |
Run scriptapi_on_shutdown() thread-safely and remove some old crap
-rw-r--r-- | src/server.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/server.cpp b/src/server.cpp index 67c1ce927..a793c6e2a 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(); } |