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

Desktop.getDesktop().setQuitHandler handler doesn't trigger in 21.0.2+

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      MacBook Pro 2021 with Apple M1 Pro (has also been reproduced with an Intel Mac on our codebase)
      macOS Sonoma Version 14.4.1 (23E224)
      Amazon Corretto 21.0.3


      A DESCRIPTION OF THE PROBLEM :
      We have this setup in our application
      if (Desktop.getDesktop().isSupported(Desktop.Action.APP_QUIT_HANDLER)) {
          Desktop.getDesktop().setQuitHandler((e, response) -> // our quit code here
          ));
      }
      (Desktop is an awt class)
      Up until JavaFx 21.0.1 this has worked. In JavaFx 21.0.2 and higher (including 22.x and 23ea) the handler does not get called anymore (attaching a breakpoint to the handler code reveals this). This results in the quit option in the dock popup menu to do nothing instead of quitting the application.

      REGRESSION : Last worked in version 21

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Setup a quitHandler like so
      (Desktop.getDesktop().isSupported(Desktop.Action.APP_QUIT_HANDLER)) {
          Desktop.getDesktop().setQuitHandler((e, response) -> // quit code here
          ));
      }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Dock popup menu's quit option triggers this handler.
      ACTUAL -
      Nothing happens when the dock popup menu's quit option is clicked.

      CUSTOMER SUBMITTED WORKAROUND :
      Downgrading to 21.0.1 or lower fixes the issue however there are other issues in 21.0.1 and lower that we'd like to fix by upgrading.

      FREQUENCY : always


            kcr Kevin Rushforth
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: