jdk/src/macosx/native/sun/awt/LWCToolkit.m
changeset 23921 1cb9d9ff4e61
parent 23893 1a92335b55bb
child 24183 db8b6b7d25c0
--- a/jdk/src/macosx/native/sun/awt/LWCToolkit.m	Fri Feb 07 19:49:58 2014 +0400
+++ b/jdk/src/macosx/native/sun/awt/LWCToolkit.m	Thu Feb 20 09:36:58 2014 +0400
@@ -221,14 +221,15 @@
 Java_sun_lwawt_macosx_LWCToolkit_initIDs
 (JNIEnv *env, jclass klass) {
     // set thread names
-    dispatch_async(dispatch_get_main_queue(), ^(void){
-        [[NSThread currentThread] setName:@"AppKit Thread"];
-
-        JNIEnv *env = [ThreadUtilities getJNIEnv];
-        static JNF_CLASS_CACHE(jc_LWCToolkit, "sun/lwawt/macosx/LWCToolkit");
-        static JNF_STATIC_MEMBER_CACHE(jsm_installToolkitThreadInJava, jc_LWCToolkit, "installToolkitThreadInJava", "()V");
-        JNFCallStaticVoidMethod(env, jsm_installToolkitThreadInJava);
-    });
+    if (![ThreadUtilities isAWTEmbedded]) {
+        dispatch_async(dispatch_get_main_queue(), ^(void){
+            [[NSThread currentThread] setName:@"AppKit Thread"];
+            JNIEnv *env = [ThreadUtilities getJNIEnv];
+            static JNF_CLASS_CACHE(jc_LWCToolkit, "sun/lwawt/macosx/LWCToolkit");
+            static JNF_STATIC_MEMBER_CACHE(jsm_installToolkitThreadInJava, jc_LWCToolkit, "installToolkitThreadInJava", "()V");
+            JNFCallStaticVoidMethod(env, jsm_installToolkitThreadInJava);
+        });
+    }
     
     gNumberOfButtons = sun_lwawt_macosx_LWCToolkit_BUTTONS;