From 00928fdb889f37cbac0c3b9fddb5262a965b1324 Mon Sep 17 00:00:00 2001 From: mcrcortex <18544518+MCRcortex@users.noreply.github.com> Date: Sat, 19 Jul 2025 23:21:04 +1000 Subject: [PATCH] Fix render generation service task map entries not being removed --- .../building/RenderGenerationService.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderGenerationService.java b/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderGenerationService.java index 7c9f2ec1..01020a14 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderGenerationService.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderGenerationService.java @@ -141,6 +141,17 @@ public class RenderGenerationService { section = task.section; } + + {//Remove the task from the map, this is done before we check for null sections as well the task map needs to be correct + long stamp = this.taskMapLock.writeLock(); + var rtask = this.taskMap.remove(task.position); + if (rtask != task) { + this.taskMapLock.unlockWrite(stamp); + throw new IllegalStateException(); + } + this.taskMapLock.unlockWrite(stamp); + } + if (section == null) { if (this.resultConsumer != null) { this.resultConsumer.accept(BuiltSection.empty(task.position)); @@ -150,15 +161,6 @@ public class RenderGenerationService { section.assertNotFree(); BuiltSection mesh = null; - { - long stamp = this.taskMapLock.writeLock(); - var rtask = this.taskMap.remove(task.position); - if (rtask != task) { - this.taskMapLock.unlockWrite(stamp); - throw new IllegalStateException(); - } - this.taskMapLock.unlockWrite(stamp); - } try { mesh = factory.generateMesh(section);