-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
When removing two child nodes in the same frame from onUpdate blocks then the iteration of the children crashes with an IndexOutOfBoundsException.
To reproduce:
repeat(2) {
addNode(Node().apply {
onUpdate {
if (Time.gameTime > 2f) {
parent!!.removeNode(this)
}
}
})
}Stacktrace:
Exception in thread "kool-main-backend-thread" java.lang.IndexOutOfBoundsException: Index 4 out of bounds for length 4
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at java.base/java.util.Objects.checkIndex(Objects.java:361)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at de.fabmax.kool.scene.Node.update(Node.kt:147)
at de.fabmax.kool.scene.Scene.update(Scene.kt:117)
at de.fabmax.kool.pipeline.RenderPass$View.update$kool_core(RenderPass.kt:241)
at de.fabmax.kool.pipeline.RenderPass.update(RenderPass.kt:65)
at de.fabmax.kool.scene.Scene$ScreenPass.update(Scene.kt:199)
at de.fabmax.kool.pipeline.GpuPass.collect(GpuPass.kt:42)
at de.fabmax.kool.scene.Scene.collectScene$kool_core(Scene.kt:93)
at de.fabmax.kool.KoolContext.render(KoolContext.kt:90)
at de.fabmax.kool.platform.Lwjgl3Context.access$render(Lwjgl3Context.kt:24)
at de.fabmax.kool.platform.Lwjgl3Context$renderFrame$2.invokeSuspend(Lwjgl3Context.kt:85)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:829)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)Metadata
Metadata
Assignees
Labels
No labels