jds691 / Twig

A lightweight game library for JavaFX.
0 stars 0 forks source link

ConcurrentModificationException when changing Scene.root mid-frame #2

Closed jds691 closed 7 months ago

jds691 commented 8 months ago

A ConcurrentModificationException is thrown when attempting to add or remove from the scene root in the middle of a frame.

To fix this issue a queue system should be implemented which adds or removes the nodes from the root after a frame has been processed.

jds691 commented 8 months ago

This problem also occurs with the Node class for it's components and children fields.

jds691 commented 8 months ago

This seems to potentially affect Engine.quit as well.

jds691 commented 8 months ago

A potential solution to this is maintaining multiple roots and swapping them each frame but this requires double the amount of memory.