Fix render generation service task map entries not being removed

This commit is contained in:
mcrcortex
2025-07-19 23:21:04 +10:00
parent 4a34b29b46
commit 00928fdb88

View File

@@ -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);