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

JFXPanel calls InputMethodRequests on wrong thread

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • jfx23
    • jfx21, jfx22
    • javafx
    • None
    • Windows 11

    • b02

      Found this while researching JDK-8090267. While using an IM window inside a JFXPanel the AWT code will call into the InputMethodRequests on the AWT EventQueue thread. These calls are being passed straight into JavaFX on that same thread. As far as I know the InputMethodRequests can only be called safely on the JavaFX thread.

      This happens on all platforms but so far I've only been able to create a reproducible case on Windows 11 (I can't test Win10). The two threads are asking the same Text object to layout the glyphs in an interleaved manner.

      Steps to reproduce:
      - Switch to Japanese in half-width alphanumeric mode (you should see an "A" in the task bar next to the Japanese IM log)
      - Run the attached test program
      - Press "a" twice
      - Switch to Hiragana (click once on the "A" in the task bar)
      - Press the "a" key again

      Expected results:
      - In the text field you should see two "a" characters followed by a Japanese glyph

      Actual results:
      - The entered text is duplicated, two a's followed by a Japanese glyph followed by two a's and the same Japanese glyph

        1. FXPanelThreadBug.java
          1 kB
        2. JapIME.png
          JapIME.png
          7 kB
        3. JapIME-bug.png
          JapIME-bug.png
          7 kB

            mfox Martin Fox
            mfox Martin Fox
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: