hg: macosx-port/macosx-port/jdk: Fix for MACOSX_PORT-456: DnDTextDropTest 0001 fails in JCK-runtime-7 interactive

Mike Swingler swingler at apple.com
Tue Nov 15 07:47:57 PST 2011


On Nov 15, 2011, at 2:59 AM, alexander.zuev at oracle.com wrote:

> Changeset: bd6849181039
> Author:    kizune
> Date:      2011-11-15 14:58 +0300
> URL:       http://hg.openjdk.java.net/macosx-port/macosx-port/jdk/rev/bd6849181039
> 
> Fix for MACOSX_PORT-456: DnDTextDropTest 0001 fails in JCK-runtime-7 interactive
> 
> ! src/macosx/native/sun/awt/CDropTarget.m
> ! src/macosx/native/sun/awt/CDropTargetContextPeer.m
> 

This seems problematic:
--- a/src/macosx/native/sun/awt/CDropTarget.m	Mon Nov 14 21:09:29 2011 +0300
+++ b/src/macosx/native/sun/awt/CDropTarget.m	Tue Nov 15 14:58:46 2011 +0300
@@ -320,7 +320,11 @@ extern JNFClassInfo jc_CDropTargetContex
 
 - (jobject) copyDraggingDataForFormat:(jlong)format
 {
-    JNIEnv*      env = [ThreadUtilities getJNIEnv]; // Can be called from threads other than the native event thread!
+    __block JNIEnv*      env;
+	
+	[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+		env = [ThreadUtilities getJNIEnv]; // Can be called from threads other than the native event thread!
+	}];
     NSData*      data = nil;
 
     // Convert the Java format (datatransferer int index) to a pasteboard format (NSString):

You can't use the AppKit/Thread-0 Env from another thread, or HotSpot can crash. You need to use an Env that is local to your thread, no matter what thread it gets called from, and if that means attaching the current thread, so be-it.

Regards,
Mike Swingler
Apple Inc.



More information about the macosx-port-dev mailing list