提交 8adb7798 编写于 作者: D denis

6945178: SecurityException upon drag-and-drop

Summary: A flag added to distinguish drop action handling.
Reviewed-by: uta, art
上级 b5470301
...@@ -94,6 +94,11 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer, ...@@ -94,6 +94,11 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer,
protected int dropStatus = STATUS_NONE; protected int dropStatus = STATUS_NONE;
protected boolean dropComplete = false; protected boolean dropComplete = false;
// The flag is used to monitor whether the drop action is
// handled by a user. That allows to distinct during
// which operation getTransferData() method is invoked.
boolean dropInProcess = false;
/* /*
* global lock * global lock
*/ */
...@@ -220,7 +225,7 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer, ...@@ -220,7 +225,7 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer,
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
try { try {
if (!dropComplete && sm != null) { if (!dropInProcess && sm != null) {
sm.checkSystemClipboardAccess(); sm.checkSystemClipboardAccess();
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -526,6 +531,8 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer, ...@@ -526,6 +531,8 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer,
setCurrentJVMLocalSourceTransferable(null); setCurrentJVMLocalSourceTransferable(null);
} }
dropInProcess = true;
try { try {
((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc, ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
hots, hots,
...@@ -538,6 +545,7 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer, ...@@ -538,6 +545,7 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer,
} else if (dropComplete == false) { } else if (dropComplete == false) {
dropComplete(false); dropComplete(false);
} }
dropInProcess = false;
} }
} else { } else {
rejectDrop(); rejectDrop();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册