jdk/src/macosx/native/sun/awt/LWCToolkit.m
changeset 12177 7b84ed7d0efa
parent 12047 320a714614e9
child 12641 40df38d36cb4
--- a/jdk/src/macosx/native/sun/awt/LWCToolkit.m	Wed Mar 21 14:31:29 2012 +0400
+++ b/jdk/src/macosx/native/sun/awt/LWCToolkit.m	Wed Mar 21 15:25:12 2012 +0400
@@ -401,18 +401,21 @@
 JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isApplicationActive
 (JNIEnv *env, jclass clazz)
 {
-        __block jboolean active = JNI_FALSE;
+    __block jboolean active = JNI_FALSE;
 
-AWT_ASSERT_NOT_APPKIT_THREAD;
 JNF_COCOA_ENTER(env);
 
+    if ([NSThread isMainThread]) {
+        active = (jboolean)[NSRunningApplication currentApplication].active;
+    } else {
         [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^() {
-                active = (jboolean)[NSRunningApplication currentApplication].active;
+            active = (jboolean)[NSRunningApplication currentApplication].active;
         }];
+    }
 
 JNF_COCOA_EXIT(env);
 
-        return active;
+    return active;
 }