From 03d67af9e85b9641556c8ea2276aa07f6fca175e Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Thu, 23 Dec 2010 10:29:09 +0200 Subject: a mutex added to TempMods which hopefully fixes rare segfaults on client --- src/mapblock.cpp | 82 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 38 deletions(-) (limited to 'src/mapblock.cpp') diff --git a/src/mapblock.cpp b/src/mapblock.cpp index b2b5bc4f4..186256589 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -47,6 +47,7 @@ MapBlock::MapBlock(NodeContainer *parent, v3s16 pos, bool dummy): m_mesh_expired = false; mesh_mutex.Init(); mesh = NULL; + m_temp_mods_mutex.Init(); #endif } @@ -584,47 +585,52 @@ void MapBlock::updateMesh(u32 daynight_ratio) NOTE: This is the slowest part of this method. */ + + { + // Lock this, as m_temp_mods will be used directly + JMutexAutoLock lock(m_temp_mods_mutex); - /* - Go through every y,z and get top faces in rows of x+ - */ - for(s16 y=0; y