Run scriptapi_on_shutdown() thread-safely and remove some old crap

This commit is contained in:
Perttu Ahola 2012-11-30 19:41:13 +02:00
parent 6c8fa83ecd
commit 8a93581c8a

@ -1113,10 +1113,15 @@ Server::~Server()
} }
} }
{
JMutexAutoLock envlock(m_env_mutex);
JMutexAutoLock conlock(m_con_mutex);
/* /*
Execute script shutdown hooks Execute script shutdown hooks
*/ */
scriptapi_on_shutdown(m_lua); scriptapi_on_shutdown(m_lua);
}
{ {
JMutexAutoLock envlock(m_env_mutex); JMutexAutoLock envlock(m_env_mutex);
@ -1149,14 +1154,6 @@ Server::~Server()
i = m_clients.getIterator(); i = m_clients.getIterator();
i.atEnd() == false; i++) 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 client
delete i.getNode()->getValue(); delete i.getNode()->getValue();
} }