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

MenuBarSkin: exception initializing in a background thread

XMLWordPrintable

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

      MenuButtonSkin fails to initialize in a background thread, throwing an IllegalStateException calling Toolkit.getToolkit().getSystemMenu().isSupported() in MenuBarSkin:822

      ```
          @Test
          public void menuBar() {
              MenuBar c = new MenuBar();
              c.setSkin(new MenuBarSkin(c));
          }
      ```

      ## Root Cause

      MenuBarSkin.rebuildUI() relies on Toolkit.getToolkit().getSystemMenu().isSupported() which can only be invoked in the FX application thread.

      ## Possible Solution

      Postpone rebuildUI() until after the menu gets added to a Window (similarly to Chart fix https://bugs.openjdk.org/browse/JDK-8349091 ).

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

              Created:
              Updated: