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

[macosx] When the screen menu bar is used, clearing the default menu bar should permit AWT shutdown

XMLWordPrintable

    • b04
    • x86
    • os_x

      FULL PRODUCT VERSION :


      ADDITIONAL OS VERSION INFORMATION :
      Darwin Kernel Version 16.7.0: Mon Nov 13 21:56:25 PST 2017; root:xnu-3789.72.11~1/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      On macOS, when the screen menu bar is enabled using -Dapple.laf.useScreenMenuBar=true, setting a default menu bar (correctly) inhibits the automatic shutdown of AWT. Removing the default menu bar should remove this inhibition, but it does not. The problem is that the screen menu bar peers are not unregistered.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      See test code, which must be run with -Dapple.laf.useScreenMenuBar=true.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The program should terminate.
      ACTUAL -
      The program does not terminate.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package test;

      import java.awt.Desktop;
      import javax.swing.JMenuBar;
      import javax.swing.SwingUtilities;

      public class Test
      {
      public Test()
      {
      SwingUtilities.invokeLater(() ->
      {
      JMenuBar mb = new JMenuBar();
      Desktop.getDesktop().setDefaultMenuBar(mb);
      Desktop.getDesktop().setDefaultMenuBar(null);
      }
      );
      }

      public static void main(String[] args)
      {
      new Test();
      }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Of course, System.exit() can be used, but that is not always desirable.

        1. Test.java
          1 kB
          Pardeep Sharma

            serb Sergey Bylokhov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: