-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8315657: Application window not activated in macOS 14 Sonoma #1247
8315657: Application window not activated in macOS 14 Sonoma #1247
Conversation
This is a preliminary fix with a few debugging statements
@jperedadnr Do you have access to a macOS 14 beta system that you could use to test this fix? |
👋 Welcome back kcr! A progress list of the required criteria for merging this PR into |
Yes, I could do a build and ask someone with macOS 14 beta to test it. |
Because I updated my Laptop to Sonoma (so I find bugs earlier) - I was able to test it! With this branch,
And the mysterious (did anyone notice?) 5 Seconds freeze before showing the App is also gone! So, I can confirm this fixes these important Sonoma bugs! |
That's good news.
The warning and the 5 second freeze are the same problem.
Thanks for confirming. I'll remove the debug prints and make this PR "rfr". |
/reviewers 2 |
@kevinrushforth |
I can confirm that the proposed fix works on macOS Sonoma beta. We have tested an application installed via jpackage. Now the application is launched properly into the foreground. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, and testing on macOS 14 beta works with the proposed fix.
Minor: if you update the copyright of license headers I'll reapprove again.
I usually prefer not to, especially for a fix like this that will be backported across multiple releases (it helps avoid trivial merge conflicts). Our copyright update scripts will pick it up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not have access to a system with 10.14.
Code changes look reasonable. Approving based on this assumption and fix confirmation by others in this PR.
@kevinrushforth This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 2 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit f2dd4bd.
Your commit was automatically rebased without conflicts. |
@kevinrushforth Pushed as commit f2dd4bd. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The fix for JDK-8233678 added a step to the NSApplication initialization to deactivate and then reactivate the application. We trigger the deactivation the first time applicationDidBecomeActive is called. We then trigger the reactivation the when applicationDidResignActive is called after that. The initialization logic in MacApplication spins up a nested event loop that waits for the reactivation (a second call to applicationDidBecomeActive).
Something in macOS 14 has changed that prevents the initial call to applicationDidBecomeActive from being done until the application has finished launching (notifyDidFinishLaunching).
So the activation of the NSApplication is waiting for the launching to be finished, but the nested event loop we spin up is blocking the completion of launching until we get the activation. This is a classic deadlock.
The good news, though, is the deactivation / reactivation of the application no longer seems to be needed on macOS 14. The menus work fine without that fix.
The proposed solution is to check the version of macOS and only enable the deactivation / reactivation logic on systems prior to macOS 14. This will have the additional benefit of avoiding the brief flash when the app is first launched (see JDK-8257835).
This is a Draft PR with a few debugging statements. Once I get some feedback that it works for more than just me, I'll remove the debugging statements and then make it "rfr".
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1247/head:pull/1247
$ git checkout pull/1247
Update a local copy of the PR:
$ git checkout pull/1247
$ git pull https://git.openjdk.org/jfx.git pull/1247/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1247
View PR using the GUI difftool:
$ git pr show -t 1247
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1247.diff
Webrev
Link to Webrev Comment