-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P4
-
Affects Version/s: 8u5
-
Component/s: javafx
-
None
In com.sun.javafx.scene.KeyboardShortcutsHandler.processAccelerators we iterate over the accelerators with a for statement. This means an accelerator cannot remove itself in its own callback. For example, this crops up if you have a "back" keyboard shortcut that is bound when a new part of the UI appears and wants to remove itself once the user has pressed it.
A simple fix would be to duplicate the entrySet before starting the for loop. Alternatively and more ambitiously ObservableEntrySet/ObservableMap could be upgraded to make iterators survive modification a la CopyOnWriteArrayList.
In a library I maintain we use COW lists for all event listener registrations, exactly for this reason.
A simple fix would be to duplicate the entrySet before starting the for loop. Alternatively and more ambitiously ObservableEntrySet/ObservableMap could be upgraded to make iterators survive modification a la CopyOnWriteArrayList.
In a library I maintain we use COW lists for all event listener registrations, exactly for this reason.