Oops, you're right, it definitely crashes. I'll put that code back and take Artem's suggestion.
-DrD- > Artem is correct. On Mac we can't start a GUI session via ssh, for example. > Thus we choose the headless mode then. The isInAquaSession() is supposed to > perform exactly this check. This logic needs to be preserved. > > -- > best regards, > Anthony > > On 10/22/2013 01:23 PM, Artem Ananiev wrote: >> Hi, David, >> >> thanks for additional cleanup. >> >> I have only one concern. Before the fix, we checked if there is an >> active Aqua session. When no session was found, we falled back to >> HToolkit. I think this logic should be preserved, but slightly >> corrected: fall back to HeadlessToolkit (with CToolkit wrapped in). >> >> Otherwise the only way to run headless on Mac will be to force it with >> the system property. It works this way on Windows, but on Windows we're >> sure that WToolkit can run even without a UI session. Is it also true on >> Mac? Did you try to launch AWT without -Djava.awt.headless=true from >> remote console with no users logged in? >> >> Thanks, >> >> Artem >> >> On 10/22/2013 7:34 AM, David DeHaven wrote: >>> >>> Updated webrev for JDK (hotspot change is the same): >>> http://cr.openjdk.java.net/~ddehaven/8025673/jdk.1/ >>> >>> Changes since last version: >>> - Moved to jdk8/build/jdk to save someone a merge headache, moved >>> changes to CompileNativeLibs.gmk to libs/Awt2dLibraries.gmk >>> - Removed HToolkit option and toolkit selection code from >>> java_props_macosx.[ch] >>> >>> -DrD- >>> >>> >>>> I want to do one more iteration of this. Based on feedback it seems I >>>> can remove a bit more code from java_props_macosx.[ch] and make >>>> things a bit cleaner. >>>> >>>> -DrD- >>>> >>>>> Thanks guys. >>>>> >>>>> Anthony, can you sponsor this for me? >>>>> >>>>> -DrD- >>>>> >>>>>> This fix looks fine to me as well. >>>>>> >>>>>> -- >>>>>> best regards, >>>>>> Anthony >>>>>> >>>>>> On 10/20/2013 11:56 PM, David DeHaven wrote: >>>>>>> >>>>>>> CCing: build-dev, macosx-port-dev, hotspot-dev >>>>>>> >>>>>>> Request for review of JDK-8025673: >>>>>>> https://bugs.openjdk.java.net/browse/JDK-8025673 >>>>>>> >>>>>>> Proposed changes: >>>>>>> http://cr.openjdk.java.net/~ddehaven/8025673/ >>>>>>> >>>>>>> This change disables building libawt_xawt.dylib and >>>>>>> libawt_headless.dylib on Mac since they are not used and not >>>>>>> supported. There are too many challenges (and not enough time) in >>>>>>> removing all X11 code from the Mac build at this time, so we're >>>>>>> deferring complete removal for later (will be covered by >>>>>>> JDK-8003900). >>>>>>> >>>>>>> A small change to hotspot is required as it was looking for >>>>>>> libawt_xawt.dylib and if not found would set java.awt.headless to >>>>>>> true. Since we don't build a headless only JRE on Mac I just have >>>>>>> that method return false. I'm not sure how to handle changes to >>>>>>> hotspot, can it be pushed along with the jdk changes? Without that >>>>>>> change the Mac builds will be broken. >>>>>>> >>>>>>> Significant build system changes, build-dev guys are encouraged to >>>>>>> comment... >>>>>>> >>>>>>> I tried excluding all sun/awt/X11 classes in >>>>>>> CompileJavaClasses.gmk but that broke JNI header generation on >>>>>>> platforms still using X11 and I couldn't use the big list of >>>>>>> excluded files on Mac as that resulted in Java compilation errors, >>>>>>> so I just added some logic to exclude everything on Mac and left >>>>>>> the list in place everywhere else. >>>>>>> >>>>>>> The changes to CompileNativeLibraries.gmk will port to >>>>>>> libs/AwtJava2dLibraries.gmk in jdk8/build, however there is a >>>>>>> problem in the jdk8/build workspace where the build cannot find >>>>>>> symbols in JNI libs so that issue needs to be resolved first. I've >>>>>>> not had time to investigate that problem. >>>>>>> >>>>>>> >>>>>>> Question for the AWT team, we still have this in java_props_md.c: >>>>>>> 458 PreferredToolkit prefToolkit = getPreferredToolkit(); >>>>>>> 459 if (prefToolkit == CToolkit) { >>>>>>> 460 sprops.awt_toolkit = "sun.lwawt.macosx.LWCToolkit"; >>>>>>> 461 } else { >>>>>>> 462 // TODO: do we still need this? >>>>>>> 463 sprops.awt_toolkit = "sun.awt.HToolkit"; >>>>>>> 464 } >>>>>>> >>>>>>> Is that necessary? Since we're now using libawt_lwawt in both >>>>>>> headless and headful modes I would think we could remove the >>>>>>> HToolkit option, but I'm not 100% certain about that. >>>>>>> >>>>>>> >>>>>>> I've built and tested on Mac and a Linux VM (Ubuntu 12.04) and >>>>>>> both seem to be working fine. >>>>>>> >>>>>>> JPRT run for Mac is in progress, I will submit one for all other >>>>>>> platforms when it finishes building. >>>>>>> >>>>>>> -DrD- >>>>>>> >>>>> >>>> >>>