-
Notifications
You must be signed in to change notification settings - Fork 802
fix: avoid race to call some API before NSApplication is running #21175
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
base: master
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR fixes a race condition where NSApplication APIs were being called before NSApplicationMain had fully initialized the application, which could return incorrect values. The fix ensures that the application startup code is deferred until NSApplication is ready by using a callback mechanism.
Key changes:
- Added a new callback mechanism to defer application startup until NSApplication is ready
- Moved resource path initialization into the deferred startup callback
- Added proper error handling for the native callback execution
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
UNOApplication.m | Implements the application start callback mechanism and triggers it when NSApplication finishes launching |
UNOApplication.h | Declares the application start callback function pointer type |
NativeUno.cs | Adds P/Invoke declaration for setting the application start callback |
MacSkiaHost.cs | Refactors startup flow to use the callback mechanism and adds error handling |
src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOApplication.m
Show resolved
Hide resolved
src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOApplication.m
Show resolved
Hide resolved
src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOApplication.m
Show resolved
Hide resolved
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21175/docs/index.html |
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21175/wasm-skia-net9/index.html |
|
The build 172313 found UI Test snapshots differences: Details
|
GitHub Issue: closes #20742
PR Type:
What is the current behavior? 🤔
There's a race where we can call some
NSApplication
API beforeNSApplicationMain
. In such case the returned value is incorrect.This replaces the workaround #21124 made for the 6.1 branch.
What is the new behavior? 🚀
The
StartApp
code is invoked, from native code, whenNSApplication
is ready.PR Checklist ✅
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Run
results.Other information ℹ️