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

[macosx] showing modal dialog in DropTargetListener.drop() causes freeze/deadlock on OS X

XMLWordPrintable

    • x86
    • os_x

      FULL PRODUCT VERSION :
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      OS X 10.10.5
      OS X 10.9.3

      A DESCRIPTION OF THE PROBLEM :
      Showing a modal dialog from DropTargetListener.drop(DropTargetDropEvent) causes the UI to lock up.

      This happens on an OS X 10.10.5 and an OS X 10.9.3 system that we tried, but not on one 10.7 system.

      Problem did not happen on Java 8 update 51.

      REGRESSION. Last worked in version 8u51

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run code.
      Drag, for example, a file from Finder onto the window.
      Attempt to "OK" the dialog that pops up.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      "OK" should close the dialog.
      ACTUAL -
      The dialog will not close. The UI is frozen.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.dnd.*;
      import javax.swing.*;

      public class DropTest {

         public static void main(String[] args) {
            SwingUtilities.invokeLater(
               new Runnable() {
                  public void run() {
                     launchGui();
                  }
               });
         }
         
         public static void launchGui() {
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            final JPanel c = new JPanel();
            f.getContentPane().add(c);
            new DropTarget(c,
               new DropTargetAdapter() {
                  public void drop(final DropTargetDropEvent e) {
                     JOptionPane.showMessageDialog(c, "Test");
                  }
               });
            f.setSize(400, 400);
            f.setVisible(true);
         }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      From DropTargetListener.drop(), do anything that might show a modal dialog in SwingUtilities.invokeLater().


            mhalder Manajit Halder (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: