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

DnD hangs when windows overlap

    XMLWordPrintable

Details

    • generic
    • generic

    Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10 Enterprise 22H2

      Reproduced with
      Oracle JDK 20+36-2344
      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, and
      - the source both application windows are overlapping

      The freeze happens right after a mouse drag crosses the window border of the Java application. (see https://youtu.be/j1JqeC3IvWQ )

      It is not occurring on every DnD action, but happens regularly after some (10-15) actions. The impact is actually severe as the application needs to be killed, potentially with unsaved data.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      For detailed demo see: <LINK>

      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. Overlap the windows explorer window with the test application
      5. Set the focus back again on the input field and therewith on the test application
      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(Runtime.version().toString());
              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 res

      FREQUENCY : often


      Attachments

        Issue Links

          Activity

            People

              honkar Harshitha Onkar
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: