Correctly lock mutexes when the server sends MapEditEvents (could cause memory corrup...
authorPerttu Ahola <celeron55@gmail.com>
Wed, 28 Mar 2012 09:51:47 +0000 (12:51 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Wed, 28 Mar 2012 09:51:47 +0000 (12:51 +0300)
src/server.cpp

index 8c03ec88008a56c70c908d94c9b6fc9917eb2c70..6756e4a0884a92c631988375f45b11c81af6a5d5 100644 (file)
@@ -1689,6 +1689,10 @@ void Server::AsyncRunStep()
                Send queued-for-sending map edit events.
        */
        {
+               // We will be accessing the environment and the connection
+               JMutexAutoLock lock(m_env_mutex);
+               JMutexAutoLock conlock(m_con_mutex);
+
                // Don't send too many at a time
                //u32 count = 0;