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

Enforce Platform threading use

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • jfx25
    • jfx23
    • javafx
    • None
    • Fix Understood

      Javadoc for Platform::accessibilityActive property specifies that

      <p>This method may be called from any thread.</p>

      Not only this is not true as neither accessor nor property getter is properly synchronized, but more importantly, adding a listener or a binding to the said property outside of the JavaFX application thread will likely cause concurrent access issues when the caller, still being executing in the background thread, receives an event in the context of the JavaFX application thread.

      To avoid that, these calls should fail fast with an IllegalStateException.

      In general, while JavaFX allows for creating some objects in a background thread, special care must be applied to avoid accessing platform's globals and statics, unless explicitly permitted.

      (Side note: a similar enforcement should probably be added to Platform::getPreferences)


      This issue came as a result of the code review https://github.com/openjdk/jfx/pull/1697

            angorya Andy Goryachev
            angorya Andy Goryachev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: