diff options
-rw-r--r-- | src/LightingThread.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/LightingThread.cpp b/src/LightingThread.cpp index b665066ee..8fbfb29db 100644 --- a/src/LightingThread.cpp +++ b/src/LightingThread.cpp @@ -136,11 +136,13 @@ void cLightingThread::QueueChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback ASSERT(m_World != NULL); // Did you call Start() properly? cChunkStay * ChunkStay = new cLightingChunkStay(*this, a_ChunkX, a_ChunkZ, a_CallbackAfter); + { + cCSLock Lock(m_CS); + m_PendingQueue.push_back(ChunkStay); + } ChunkStay->Enable(*m_World->GetChunkMap()); // The ChunkStay will enqueue itself using the QueueChunkStay() once it is fully loaded // In the meantime, put it into the PendingQueue so that it can be removed when stopping the thread - cCSLock Lock(m_CS); - m_PendingQueue.push_back(ChunkStay); } |