< prev index next >
src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m
Print this page
rev 58521 : 7185258: [macosx] Deadlock in SunToolKit.realSync()
Reviewed-by: XXX
@@ -35,10 +35,11 @@
#import "CDataTransferer.h"
#import "CDropTarget.h"
#import "CDragSource.h"
#import "DnDUtilities.h"
#import "ThreadUtilities.h"
+#import "LWCToolkit.h"
// When sIsJavaDragging is true Java drag gesture has been recognized and a drag is/has been initialized.
// We must stop posting MouseEvent.MOUSE_DRAGGED events for the duration of the drag or all hell will break
// loose in shared code - tracking state going haywire.
@@ -509,13 +510,13 @@
// Set up the fDragKeyModifier, so we know if the operation has changed
// Set up the fDragMouseModifier, so we can |= it later (since CoreDrag doesn't tell us mouse states during a drag)
fDragKeyModifiers = [DnDUtilities extractJavaExtKeyModifiersFromJavaExtModifiers:fModifiers];
fDragMouseModifiers = [DnDUtilities extractJavaExtMouseModifiersFromJavaExtModifiers:fModifiers];
- sNeedsEnter = YES;
-
@try {
+ sNeedsEnter = YES;
+ AWTToolkit.inDoDragDropLoop = YES;
// Data dragging:
if (isFileDrag == FALSE) {
[view dragImage:dragImage at:dragOrigin offset:dragOffset event:dragEvent pasteboard:pb source:view slideBack:YES];
} else if (fileDragPromises == FALSE) {
// File dragging:
@@ -559,10 +560,11 @@
JNFCallVoidMethod(env, fDragSourceContextPeer, dragDropFinishedMethod, success, dragOp, (jint) point.x, (jint) point.y); // AWT_THREADING Safe (event)
JNF_MEMBER_CACHE(resetHoveringMethod, CDragSourceContextPeerClass, "resetHovering", "()V");
JNFCallVoidMethod(env, fDragSourceContextPeer, resetHoveringMethod); // Hust reset static variable
} @finally {
sNeedsEnter = NO;
+ AWTToolkit.inDoDragDropLoop = NO;
}
// We have to do this, otherwise AppKit doesn't know we're finished dragging. Yup, it's that bad.
if ([[[NSRunLoop currentRunLoop] currentMode] isEqualTo:NSEventTrackingRunLoopMode]) {
[NSApp postEvent:[self nsDragEvent:NO] atStart:YES];
@@ -605,28 +607,29 @@
- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination {
}*/
- (void)draggedImage:(NSImage *)image beganAt:(NSPoint)screenPoint {
DLog4(@"[CDragSource draggedImage beganAt]: (%f, %f) %@\n", screenPoint.x, screenPoint.y, self);
-
+ [AWTToolkit eventCountPlusPlus];
// Initialize static variables:
sDragOperation = NSDragOperationNone;
sDraggingLocation = screenPoint;
}
- (void)draggedImage:(NSImage *)image endedAt:(NSPoint)screenPoint operation:(NSDragOperation)operation {
DLog4(@"[CDragSource draggedImage endedAt:]: (%f, %f) %@\n", screenPoint.x, screenPoint.y, self);
-
+ [AWTToolkit eventCountPlusPlus];
sDraggingLocation = screenPoint;
sDragOperation = operation;
}
- (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenPoint {
//DLog4(@"[CDragSource draggedImage moved]: (%d, %d) %@\n", (int) screenPoint.x, (int) screenPoint.y, self);
JNIEnv* env = [ThreadUtilities getJNIEnv];
JNF_COCOA_ENTER(env);
+ [AWTToolkit eventCountPlusPlus];
// There are two things we would be interested in:
// a) mouse pointer has moved
// b) drag actions (key modifiers) have changed
BOOL notifyJava = FALSE;
< prev index next >