jdk/src/macosx/native/sun/awt/CDropTarget.m
changeset 16710 f041f82cdeac
parent 15985 b9e25a486549
child 20446 2452a42716c8
--- a/jdk/src/macosx/native/sun/awt/CDropTarget.m	Wed Apr 03 20:54:26 2013 +0400
+++ b/jdk/src/macosx/native/sun/awt/CDropTarget.m	Fri Apr 05 18:29:53 2013 +0100
@@ -81,9 +81,8 @@
         fComponent = JNFNewGlobalRef(env, jcomponent);
         fDropTarget = JNFNewGlobalRef(env, jdropTarget);
 
-        AWTView *awtView = [((NSWindow *) control) contentView];
-        fView = [awtView retain];
-        [awtView setDropTarget:self];
+        fView = [((AWTView *) control) retain];
+        [fView setDropTarget:self];
 
 
     } else {
@@ -177,6 +176,10 @@
 {
     DLog2(@"[CDropTarget dealloc]: %@\n", self);
 
+    if(sCurrentDropTarget == self) {
+        sCurrentDropTarget = nil;
+    }
+
     [fView release];
     fView = nil;
 
@@ -490,7 +493,10 @@
         JNF_MEMBER_CACHE(handleEnterMessageMethod, jc_CDropTargetContextPeer, "handleEnterMessage", "(Ljava/awt/Component;IIII[JJ)I");
         if (sDraggingError == FALSE) {
             // Double-casting self gets rid of 'different size' compiler warning:
-            actions = JNFCallIntMethod(env, fDropTargetContextPeer, handleEnterMessageMethod, fComponent, (jint) javaLocation.x, (jint) javaLocation.y, dropAction, actions, formats, ptr_to_jlong(self)); // AWT_THREADING Safe (CToolkitThreadBlockedHandler)
+            // AWT_THREADING Safe (CToolkitThreadBlockedHandler)
+            actions = JNFCallIntMethod(env, fDropTargetContextPeer, handleEnterMessageMethod,
+                                       fComponent, (jint) javaLocation.x, (jint) javaLocation.y,
+                                       dropAction, actions, formats, ptr_to_jlong(self));
         }
 
         if (sDraggingError == FALSE) {
@@ -510,11 +516,6 @@
             // Remember the dragOp for no-op'd update messages:
             sUpdateOperation = dragOp;
         }
-
-        // If we are in the same process as the sender, make the sender post the appropriate message
-        if (sender) {
-            [[CDragSource currentDragSource] postDragEnter];
-        }
     }
 
     // 9-11-02 Note: the native event thread would not handle an exception gracefully:
@@ -608,11 +609,9 @@
         JNF_MEMBER_CACHE(handleExitMessageMethod, jc_CDropTargetContextPeer, "handleExitMessage", "(Ljava/awt/Component;J)V");
         if (sDraggingError == FALSE) {
             DLog3(@"  - dragExit: loc native %f, %f\n", sDraggingLocation.x, sDraggingLocation.y);
-            JNFCallVoidMethod(env, fDropTargetContextPeer, handleExitMessageMethod, fComponent, ptr_to_jlong(self)); // AWT_THREADING Safe (CToolkitThreadBlockedHandler)
-            // If we are in the same process as the sender, make the sender post the appropriate message
-            if (sender) {
-                [[CDragSource currentDragSource] postDragExit];
-            }
+             // AWT_THREADING Safe (CToolkitThreadBlockedHandler) 
+            JNFCallVoidMethod(env, fDropTargetContextPeer,
+                              handleExitMessageMethod, fComponent, ptr_to_jlong(self));
         }
 
         // 5-27-03 Note: [Radar 3270455]