aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-03-28 12:51:47 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-03-28 12:51:47 +0300
commit14a8fa4d68b54782ac6183263414ab2bee6fcaf7 (patch)
tree123fd02debc301b1a79f51afb785903b7ee17897
parent07e5c9bd5fb2cc5c660c208886b7033d8dd21979 (diff)
downloadminetest-14a8fa4d68b54782ac6183263414ab2bee6fcaf7.tar.gz
minetest-14a8fa4d68b54782ac6183263414ab2bee6fcaf7.tar.bz2
minetest-14a8fa4d68b54782ac6183263414ab2bee6fcaf7.zip
Correctly lock mutexes when the server sends MapEditEvents (could cause memory corruption)
-rw-r--r--src/server.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 8c03ec880..6756e4a08 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -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;