changeset 5427:002ca3d97d19

7174704: [macosx] New issue in 7u6 b12: HeadlessPrintingTest failure Summary: Revert a fix for 7144542, and don't install run loop observers in headless mode Reviewed-by: art, leonidr
author anthony
date Fri, 22 Jun 2012 15:20:55 +0400
parents 8f37aad76b5b
children f1e9d1264ce6
files src/macosx/native/sun/awt/awt.m src/solaris/native/sun/awt/awt_LoadLibrary.c
diffstat 2 files changed, 30 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/native/sun/awt/awt.m	Fri Jun 22 15:22:28 2012 +0400
+++ b/src/macosx/native/sun/awt/awt.m	Fri Jun 22 15:20:55 2012 +0400
@@ -70,33 +70,35 @@
 
     JNIEnv *env = [ThreadUtilities getJNIEnv];
 
-    // Add CFRunLoopObservers to call into AWT so that AWT knows that the
-    //  AWT thread (which is the AppKit main thread) is alive. This way AWT
-    //  will not automatically shutdown.
-    busyObserver = CFRunLoopObserverCreate(
-                        NULL,                        // CFAllocator
-                        kCFRunLoopAfterWaiting,      // CFOptionFlags
-                        true,                        // repeats
-                        NSIntegerMax,                // order
-                        &BusyObserver,               // CFRunLoopObserverCallBack
-                        NULL);                       // CFRunLoopObserverContext
+    if (!headless) {
+        // Add CFRunLoopObservers to call into AWT so that AWT knows that the
+        //  AWT thread (which is the AppKit main thread) is alive. This way AWT
+        //  will not automatically shutdown.
+        busyObserver = CFRunLoopObserverCreate(
+                NULL,                        // CFAllocator
+                kCFRunLoopAfterWaiting,      // CFOptionFlags
+                true,                        // repeats
+                NSIntegerMax,                // order
+                &BusyObserver,               // CFRunLoopObserverCallBack
+                NULL);                       // CFRunLoopObserverContext
 
-    notBusyObserver = CFRunLoopObserverCreate(
-                        NULL,                        // CFAllocator
-                        kCFRunLoopBeforeWaiting,     // CFOptionFlags
-                        true,                        // repeats
-                        NSIntegerMin,                // order
-                        &NotBusyObserver,            // CFRunLoopObserverCallBack
-                        NULL);                       // CFRunLoopObserverContext
+        notBusyObserver = CFRunLoopObserverCreate(
+                NULL,                        // CFAllocator
+                kCFRunLoopBeforeWaiting,     // CFOptionFlags
+                true,                        // repeats
+                NSIntegerMin,                // order
+                &NotBusyObserver,            // CFRunLoopObserverCallBack
+                NULL);                       // CFRunLoopObserverContext
 
-    CFRunLoopRef runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop];
-    CFRunLoopAddObserver(runLoop, busyObserver, kCFRunLoopDefaultMode);
-    CFRunLoopAddObserver(runLoop, notBusyObserver, kCFRunLoopDefaultMode);
+        CFRunLoopRef runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop];
+        CFRunLoopAddObserver(runLoop, busyObserver, kCFRunLoopDefaultMode);
+        CFRunLoopAddObserver(runLoop, notBusyObserver, kCFRunLoopDefaultMode);
 
-    CFRelease(busyObserver);
-    CFRelease(notBusyObserver);
+        CFRelease(busyObserver);
+        CFRelease(notBusyObserver);
 
-    if (!headless) setBusy(YES);
+        setBusy(YES);
+    }
 
     // Set the java name of the AppKit main thread appropriately.
     jclass threadClass = NULL;
--- a/src/solaris/native/sun/awt/awt_LoadLibrary.c	Fri Jun 22 15:22:28 2012 +0400
+++ b/src/solaris/native/sun/awt/awt_LoadLibrary.c	Fri Jun 22 15:20:55 2012 +0400
@@ -110,7 +110,7 @@
     /* Check if toolkit is specified in env variable */
 #ifdef MACOSX
     envvar = getenv("AWT_TOOLKIT");
-    if ((envvar && strstr(envvar, "XToolkit")) || AWTIsHeadless()) {
+    if (envvar && strstr(envvar, "XToolkit")) {
 #endif
         fmanager = (*env)->NewStringUTF(env, "sun.awt.X11FontManager");
         tk = "/xawt/libmawt";
@@ -127,11 +127,15 @@
     }
 
     /* Calculate library name to load */
+#ifndef MACOSX
     if (AWTIsHeadless()) {
         strcpy(p, "/headless/libmawt");
     } else if (tk) {
+#endif
         strcpy(p, tk);
+#ifndef MACOSX
     }
+#endif
 
 #ifdef MACOSX
     strcat(p, ".dylib");