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

Drag & Drop still hangs in Windows

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10 Enterprise 22H2
      Reproduced with
      Open JDK 19.0.2
      Open JDK 11.0.9.1
      Eclipse Adoptium JDK 11.0.14.9
      Oracle JDK 17.06


      A DESCRIPTION OF THE PROBLEM :
      A DnD action from an external application (e.g. Windows Explorer) into the JFrame causes both applications (Drop source & drop target) to freeze, when there is an active focus in an input field in the Java application.

      The freeze happens right after a mouse drag crosses the window border of the Java application.

      The frequency of occurrence is not deterministic. It needs up to 30 DnD-actions until the freeze appears. However, we got the impression that a faster drag movement causes the problem more likely.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Launch the test application as specified in this bugreport
      2. Set the input focus into the text field
      3. Open windows explorer and browse to an image file (might be irrelevant which file type)
      4. Drag the image from the explorer and try to drop it quickly to Java app. (Repeat this step multiple times until the freeze appears.)
      5. When frozen, only killing the Java app is possible.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      DnD does not cause the AWT Thread to hang.
      ACTUAL -
      The AWT Thread hangs in

      Thread[AWT-EventQueue-0,6,main]
      java.desktop@11.0.16.1/sun.awt.windows.WInputMethod.openCandidateWindow(Native Method)
      java.desktop@11.0.16.1/sun.awt.windows.WInputMethod$1.run(WInputMethod.java:627)
      java.desktop@11.0.16.1/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
      java.desktop@11.0.16.1/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
      java.desktop@11.0.16.1/java.awt.EventQueue$4.run(EventQueue.java:721)
      java.desktop@11.0.16.1/java.awt.EventQueue$4.run(EventQueue.java:715)
      java.base@11.0.16.1/java.security.AccessController.doPrivileged(Native Method)
      java.base@11.0.16.1/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
      java.base@11.0.16.1/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
      java.desktop@11.0.16.1/java.awt.EventQueue$5.run(EventQueue.java:745)
      java.desktop@11.0.16.1/java.awt.EventQueue$5.run(EventQueue.java:743)
      java.base@11.0.16.1/java.security.AccessController.doPrivileged(Native Method)
      ...

      ---------- BEGIN SOURCE ----------
      public class FrameWithTextField
      {
          public static void main( String[] args ) throws Exception
          {
              JFrame frame = new JFrame( "My Frame" );
              frame.setLayout( new BorderLayout() );
              
              JTextField txt = new JTextField();
              frame.add( txt, BorderLayout.CENTER );
              
              frame.setSize( 400, 400 );
              frame.setVisible( true );
              frame.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
           }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Only workaround is to build a separate thread to watch the AWT-EventQueue that restarts it in case of a freeze situation.

      FREQUENCY : occasionally


            pnarayanaswa Praveen Narayanaswamy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: