Fix possible missing unlock of env_lock
authorsapier <Sapier at GMX dot net>
Wed, 12 Feb 2014 18:47:27 +0000 (19:47 +0100)
committersapier <Sapier at GMX dot net>
Wed, 12 Feb 2014 18:47:27 +0000 (19:47 +0100)
src/server.cpp

index 66f3cc1a74d058600e4a5af05f4960b427ef2c9d..81622d6259d645c97db353ebc3f8223155cdd8c2 100644 (file)
@@ -4222,9 +4222,10 @@ void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason)
                                                <<" List of players: "<<os.str()<<std::endl;
                        }
                }
-               m_env_mutex.Lock();
-               m_clients.DeleteClient(peer_id);
-               m_env_mutex.Unlock();
+               {
+                       JMutexAutoLock env_lock(m_env_mutex);
+                       m_clients.DeleteClient(peer_id);
+               }
        }
 
        // Send leave chat message to all remaining clients