Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8112944

In Toolkit.firePulse() throws ConcurrentModificationException

XMLWordPrintable

      In Toolkit.firePulse() we iterate over scenePulseListeners. Inside those listeners it is not uncommon to call user code. That user code may doing things like show a Popup() that causes "scenePulseListeners" to change causing this exception.

      java.util.ConcurrentModificationException
      at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
      at java.util.HashMap$KeyIterator.next(HashMap.java:828)
      at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:266)
      at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:353)
      at com.sun.javafx.tk.quantum.QuantumToolkit$10.run(QuantumToolkit.java:289)

      My recommendation is to change "scenePulseListeners" from a HashSet to a CopyOnWriteArraySet as that should have minimal effect on performance while making this correct.

            morris Morris Meyer (Inactive)
            jasper Jasper Potts (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: