From 57e4bdd973030cf5d7d4120ee4ac6fb5f340a4d4 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Mon, 30 Mar 2026 19:12:22 +1100 Subject: [PATCH] Fix dirtyChunksLock scope in updateDirtyChunks Move unique_lock declaration before the FRAME_PROFILE_SCOPE block so it remains in scope for the unlock() calls in the #if/#else branches below. --- Minecraft.Client/Rendering/LevelRenderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Minecraft.Client/Rendering/LevelRenderer.cpp b/Minecraft.Client/Rendering/LevelRenderer.cpp index bd5fb6d0f..201b2f174 100644 --- a/Minecraft.Client/Rendering/LevelRenderer.cpp +++ b/Minecraft.Client/Rendering/LevelRenderer.cpp @@ -1698,6 +1698,7 @@ bool LevelRenderer::updateDirtyChunks() { ClipChunk* nearChunk = nullptr; // Nearest chunk that is dirty int veryNearCount = 0; int minDistSq = 0x7fffffff; // Distances to this chunk + std::unique_lock dirtyChunksLock(m_csDirtyChunks); // Set a flag if we should only rebuild existing chunks, not create anything // new @@ -1716,7 +1717,6 @@ bool LevelRenderer::updateDirtyChunks() { PIXAddNamedCounter(((float)memAlloc) / (1024.0f * 1024.0f), "Command buffer allocations"); bool onlyRebuild = (memAlloc >= MAX_COMMANDBUFFER_ALLOCATIONS); - std::unique_lock dirtyChunksLock(m_csDirtyChunks); // Move any dirty chunks stored in the lock free stack into global flags int index = 0;