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
1 changed files with 10 additions and 13 deletions

View File

@ -1113,10 +1113,15 @@ Server::~Server()
} }
} }
/* {
Execute script shutdown hooks JMutexAutoLock envlock(m_env_mutex);
*/ JMutexAutoLock conlock(m_con_mutex);
scriptapi_on_shutdown(m_lua);
/*
Execute script shutdown hooks
*/
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();
} }