From 1d1b0fd00d9cc370394d05d34b75516bab0344e3 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 22 Feb 2012 15:45:00 +0000 Subject: [PATCH] Fixed a potential deadlock in cChunkMap::m_CSLayers vs cWorld::m_CSAllEntities git-svn-id: http://mc-server.googlecode.com/svn/trunk@313 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cChunkMap.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/cChunkMap.cpp b/source/cChunkMap.cpp index 21b99873f..bfc1bfb4d 100644 --- a/source/cChunkMap.cpp +++ b/source/cChunkMap.cpp @@ -534,14 +534,16 @@ bool cChunkMap::DigBlock(int a_X, int a_Y, int a_Z, cItem & a_PickupItem) AbsoluteToRelative( PosX, PosY, PosZ, ChunkX, ChunkZ ); - cCSLock Lock(m_CSLayers); - cChunkPtr DestChunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); - if ((DestChunk == NULL) || !DestChunk->IsValid()) { - return false; + cCSLock Lock(m_CSLayers); + cChunkPtr DestChunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); + if ((DestChunk == NULL) || !DestChunk->IsValid()) + { + return false; + } + + DestChunk->SetBlock(PosX, PosY, PosZ, E_BLOCK_AIR, 0 ); } - - DestChunk->SetBlock(PosX, PosY, PosZ, E_BLOCK_AIR, 0 ); m_World->GetSimulatorManager()->WakeUp(a_X, a_Y, a_Z);