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

Alexander Zuev alexander.zuev at oracle.com
Tue Nov 15 10:02:29 PST 2011


On 11/15/11 6:47 PM, Mike Swingler wrote:
> On Nov 15, 2011, at 2:59 AM, alexander.zuev at oracle.com 
> <mailto: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.
So you saying that using AppKit's env is not thread-safe? Should we just 
execute the rest of the method on the AppKit thread synchronously by 
packing the rest of the code (well, minus the return part of course) 
into this block?

With best regards,
Alexander Zuev.


More information about the macosx-port-dev mailing list