changeset 17736:77a5ad135a29

8153871: [macosx] Low-level error on OS X 10.11 with DnD in Swing Reviewed-by: azvegint
author serb
date Thu, 10 Aug 2017 15:17:40 -0700
parents 9dbe51fc9d6f
children fd986bf973c6
files src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m test/javax/swing/dnd/8139050/NativeErrorsInTableDnD.java
diffstat 2 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m	Thu Aug 10 10:46:19 2017 +0530
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m	Thu Aug 10 15:17:40 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -432,12 +432,11 @@
     NSWindow* window = [fView window];
 
     NSInteger windowNumber = [window windowNumber];
-    NSGraphicsContext* graphicsContext = [NSGraphicsContext graphicsContextWithWindow:window];
 
     // Convert mouse coordinates to NS:
     NSPoint eventLocation = [fView convertPoint:NSMakePoint(fDragPos.x, fDragPos.y) toView:nil];
     eventLocation.y = [[fView window] frame].size.height - eventLocation.y;
-    
+
     // Convert fTriggerEventTimeStamp to NS - AWTEvent.h defines UTC(nsEvent) as ((jlong)[event timestamp] * 1000):
     NSTimeInterval timeStamp = fTriggerEventTimeStamp / 1000;
 
@@ -452,14 +451,16 @@
     }
 
     // Convert fModifiers (extModifiers) to NS:
-    NSUInteger modifiers = JavaModifiersToNsKeyModifiers(fModifiers, TRUE); 
+    NSUInteger modifiers = JavaModifiersToNsKeyModifiers(fModifiers, TRUE);
 
     // Just a dummy value ...
     NSInteger eventNumber = 0;
+    // NSEvent.context is deprecated and unused
+    NSGraphicsContext* unusedPassNil = nil;
 
     // Make a native autoreleased dragging event:
     NSEvent* dragEvent = [NSEvent mouseEventWithType:mouseButtons location:eventLocation
-        modifierFlags:modifiers timestamp:timeStamp windowNumber:windowNumber context:graphicsContext
+        modifierFlags:modifiers timestamp:timeStamp windowNumber:windowNumber context:unusedPassNil
         eventNumber:eventNumber clickCount:fClickCount pressure:pressure];
 
     return dragEvent;
--- a/test/javax/swing/dnd/8139050/NativeErrorsInTableDnD.java	Thu Aug 10 10:46:19 2017 +0530
+++ b/test/javax/swing/dnd/8139050/NativeErrorsInTableDnD.java	Thu Aug 10 15:17:40 2017 -0700
@@ -39,7 +39,7 @@
 
 /**
  * @test
- * @bug 8139050
+ * @bug 8139050 8153871
  * @library ../../../../lib/testlibrary
  * @build ExtendedRobot
  * @run main/othervm/timeout=360 -Xcheck:jni NativeErrorsInTableDnD