JDK-8275039 : WInputMethod hangs if an AWT Frame appears under a drag
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 16
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2021-09-22
  • Updated: 2021-10-11
  • Resolved: 2021-10-11
Related Reports
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
Windows 10, Java OpenJDK 64-Bit build 16+36-2231

A DESCRIPTION OF THE PROBLEM :
If a file drag is happening and an AWT Frame is shown under it, the EDT hangs forever.

This happens quite often in real world applications. For example, a user starts an app, then starts dragging a file with the intent to drop it on the app after the window appears.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached code. During the sleep, drag a Windows desktop icon to the screen center, so the JFrame appears beneath it.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The window to appear and the EDT to continue as normal.
ACTUAL -
The window appears, but the EDT hangs in WInputMethod#createNativeContext(). This happens every time.

---------- BEGIN SOURCE ----------
import javax.awt.Frame;
import java.awt.EventQueue;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetAdapter;
import java.awt.dnd.DropTargetDropEvent;
public class Test {
	static public void main (String[] args) throws Exception {
		Thread.sleep(1000);
		EventQueue.invokeLater( () -> {
			var frame = new JFrame();
			new DropTarget(frame, DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK, new DropTargetAdapter() {
				public void drop (DropTargetDropEvent event) {
				}
			}, true);
			frame.setSize(1024, 768);
			frame.setLocationRelativeTo(null);
			frame.setVisible(true);
		});
	}
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
There is no workaround, the app is broken and Java must be forcibly terminated.

FREQUENCY : always



Comments
Looks like duplicate of JDK-8262446, from the description issue reported inJDK 16, Checking with submitter: ================== Can you please verify If the issue is reproducible in JDK 17 General-Availability Release[1] and early access build JDK 18 Early-Access Builds[2] [1] https://jdk.java.net/17/ [2] https://jdk.java.net/18/
11-10-2021