summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/cChunk.cpp6
-rw-r--r--source/cCriticalSection.cpp6
2 files changed, 9 insertions, 3 deletions
diff --git a/source/cChunk.cpp b/source/cChunk.cpp
index 5e9c44a18..abe1d0443 100644
--- a/source/cChunk.cpp
+++ b/source/cChunk.cpp
@@ -249,7 +249,7 @@ void cChunk::Tick(float a_Dt)
}
m_pState->PendingSendBlocks.clear();
}
- cCSUnlock Unlock( Lock );
+ Lock.Unlock();
while( !m_pState->UnloadQuery.empty() )
{
@@ -261,10 +261,10 @@ void cChunk::Tick(float a_Dt)
m_pState->UnloadQuery.remove( *m_pState->UnloadQuery.begin() );
}
- m_pState->BlockListCriticalSection.Lock();
+ cCSLock Lock2(m_pState->BlockListCriticalSection);
std::map< unsigned int, int > ToTickBlocks = m_pState->ToTickBlocks;
m_pState->ToTickBlocks.clear();
- m_pState->BlockListCriticalSection.Unlock();
+ Lock2.Unlock();
bool isRedstone = false;
for( std::map< unsigned int, int>::iterator itr = ToTickBlocks.begin(); itr != ToTickBlocks.end(); ++itr )
diff --git a/source/cCriticalSection.cpp b/source/cCriticalSection.cpp
index 95ee77c3d..d7498aa5f 100644
--- a/source/cCriticalSection.cpp
+++ b/source/cCriticalSection.cpp
@@ -107,6 +107,12 @@ cCSLock::cCSLock(cCriticalSection & a_CS)
cCSLock::~cCSLock()
{
+ #ifdef _DEBUG
+ if (!m_IsLocked)
+ {
+ return;
+ }
+ #endif // _DEBUG
Unlock();
}