提交 e630ffe8 编写于 作者: P pchelko

8015455: java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java hangs on windows

Reviewed-by: serb, anthony
上级 acd1c2af
...@@ -351,6 +351,8 @@ public class DropTarget implements DropTargetListener, Serializable { ...@@ -351,6 +351,8 @@ public class DropTarget implements DropTargetListener, Serializable {
* @see #isActive * @see #isActive
*/ */
public synchronized void dragEnter(DropTargetDragEvent dtde) { public synchronized void dragEnter(DropTargetDragEvent dtde) {
isDraggingInside = true;
if (!active) return; if (!active) return;
if (dtListener != null) { if (dtListener != null) {
...@@ -421,6 +423,8 @@ public class DropTarget implements DropTargetListener, Serializable { ...@@ -421,6 +423,8 @@ public class DropTarget implements DropTargetListener, Serializable {
* @see #isActive * @see #isActive
*/ */
public synchronized void dragExit(DropTargetEvent dte) { public synchronized void dragExit(DropTargetEvent dte) {
isDraggingInside = false;
if (!active) return; if (!active) return;
if (dtListener != null && active) dtListener.dragExit(dte); if (dtListener != null && active) dtListener.dragExit(dte);
...@@ -444,6 +448,8 @@ public class DropTarget implements DropTargetListener, Serializable { ...@@ -444,6 +448,8 @@ public class DropTarget implements DropTargetListener, Serializable {
* @see #isActive * @see #isActive
*/ */
public synchronized void drop(DropTargetDropEvent dtde) { public synchronized void drop(DropTargetDropEvent dtde) {
isDraggingInside = false;
clearAutoscroll(); clearAutoscroll();
if (dtListener != null && active) if (dtListener != null && active)
...@@ -533,6 +539,12 @@ public class DropTarget implements DropTargetListener, Serializable { ...@@ -533,6 +539,12 @@ public class DropTarget implements DropTargetListener, Serializable {
((DropTargetPeer)nativePeer).removeDropTarget(this); ((DropTargetPeer)nativePeer).removeDropTarget(this);
componentPeer = nativePeer = null; componentPeer = nativePeer = null;
synchronized (this) {
if (isDraggingInside) {
dragExit(new DropTargetEvent(getDropTargetContext()));
}
}
} }
/** /**
...@@ -855,4 +867,9 @@ public class DropTarget implements DropTargetListener, Serializable { ...@@ -855,4 +867,9 @@ public class DropTarget implements DropTargetListener, Serializable {
*/ */
private transient FlavorMap flavorMap; private transient FlavorMap flavorMap;
/*
* If the dragging is currently inside this drop target
*/
private transient boolean isDraggingInside;
} }
...@@ -1268,6 +1268,14 @@ public class TransferHandler implements Serializable { ...@@ -1268,6 +1268,14 @@ public class TransferHandler implements Serializable {
} }
} }
} }
if (!isActive()) {
// If the Drop target is inactive the dragExit will not be dispatched to the dtListener,
// so make sure that we clean up the dtListener anyway.
DropTargetListener dtListener = getDropTargetListener();
if (dtListener != null && dtListener instanceof DropHandler) {
((DropHandler)dtListener).cleanup(false);
}
}
} }
public void drop(DropTargetDropEvent e) { public void drop(DropTargetDropEvent e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册