JDK-7177144 : [macosx] Drag and drop not working (regression in 7u6)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7u6
  • Priority: P1
  • Status: Closed
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86
  • Submitted: 2012-06-14
  • Updated: 2017-02-02
  • Resolved: 2012-08-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
7u6 b22Fixed 8Fixed
Related Reports
Relates :  
This is a regression in 7u6. The functionality works with 7u5.

Reported with NetBeans - Drag and drop doesn't work. You can't reorganize any tabs in window, either you can't move some selected code to another part or move classes between packages etc...

Evaluation on NetBeans side - The first attempt to drag anything (an internal window or a node in Projects/Files window) actually does start. But after a short time the dragging is interrupted for unknown reasons. The drag rectangle representing the dragged object is still being painted on the screen (on top of all windows). Furthermore, the system Dock becomes disabled and does not react to mouse events - it isn't possible to switch to other windows by clicking their Dock icons. Popup menu on the Dock doesn't work either. Switching to other apps with keyboard works fine though. After quitting the application in broken drag mode, the Dock becomes responsive again. When dragging is interrupted there's still a Thread stuck in DragSourceContextPeer.doDragging().

Not reproduced outside of NetBeans.

Note for JDK team - NetBeans implements its d'n'd support using java.awt.dnd classes, we don't use javax.swing.TransferHandler.

EVALUATION The main reason of this problem is that Drag and Drop events are being thrown away from the EventQueue by coalesceMouseEvent and proposed fix is not to put SunDropTargetEvent-derived objects into the queue used to coalesce events which prevents this type of events from disappearing.

EVALUATION This was just reproduced without TimableEventQueue, see thread dump in attachment. reproduced with Java(TM) SE Runtime Environment 1.7.0_06-ea-b18

EVALUATION As far as i see the problem sits with the org.netbeans.core.TimableEventQueue class. And the problem is that most events posted by SunDropTargetContextPeer.postDropTargetEvent get trough the event queue and being dispatched, but sometimes - mostly when mouse crosses the component border - event does not gets trough and when EventDispatchThread.pumpOneNventForFilters asks TimableEventQueue for the next event it doesn't get it and event is being stuck. And because drag'n'drop events are synchronous the post method doesn't exit until event is dispatched which is never. Hence the DnD operation stops. Looks like a problem in the NetBeans code. I'm making this CR incomplete giving NetBeans people have a say on it and if it stays incomplete for more than a week i'll go ahead and close it as working as designed.