OS/X Java native bug
OS/X Java native bug
- Subject: OS/X Java native bug
- From: Michael Hall via Cocoa-dev <email@hidden>
- Date: Fri, 17 Mar 2023 03:58:16 -0500
This was just brought to my attention on a java mailing list.
An option was added to java startup options on OS/X -XstartOnFirstThread so the
code starts on the main Appkit thread.
Currently if a java Swing application starts with that option it hangs.
https://bugs.openjdk.org/browse/JDK-8289573
This bug indicates a regression from an earlier one…
https://bugs.openjdk.org/browse/JDK-7128597
For apparently pretty much the same problem it suggests…
> If +[NSThread isMainThread] returns true, you can simply call your
> initializer directly, instead of punting it onto the main thread.
That from a former Apple Java Swing support person. Mike Swingler.
Which resulted in a fix including…
> the addition of +[NSThread isMainThread] was done at Mike's suggestion
I found some old code that seems to include that fix…
if ([NSThread isMainThread]) {
[GraphicsConfigUtil _getCGLConfigInfo: retArray];
} else {
[GraphicsConfigUtil performSelectorOnMainThread:
@selector(_getCGLConfigInfo:) withObject: retArray waitUntilDone: YES];
}
The current code that seems to regress to the original bug now looks like…
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
With what appears to be all the code that was in the selector _getCGLConfigInfo
following in an inline block. This always appears to run on main thread which I
think is the reverted to bug.
I’m not that familiar with code including blocks. Is there some fairly easy way
to modify this and keep it running as an inline block but also add the
isMainThread check to not always run on the main thread?
Or, would you have to put it back to include the check and invocation of a
standalone selector?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden