-
Notifications
You must be signed in to change notification settings - Fork 511
Draw, MacOS - Fix image generation issue #657
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: IR
Are you sure you want to change the base?
Conversation
Suppress Metal initialization errors on macOS by pre-warming graphics context
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 image generation issues on macOS by implementing Metal initialization error suppression through graphics context pre-warming. The fix addresses crashes or errors that occur during Metal framework initialization on macOS systems.
- Added Metal initialization pre-warming logic to suppress graphics context errors
- Updated version from rc1 to rc2 to reflect the fix
- Expanded test coverage to include additional test suites
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Draw/TKDraw/Draw/Draw_Window_1.mm | Implements Metal initialization pre-warming with error suppression |
| adm/cmake/version.cmake | Updates development version from rc1 to rc2 |
| .github/actions/testgrid/testmacos.tcl | Expands test coverage to include helix and standard test suites |
| static bool isMetalInitialized = false; | ||
| if (!isMetalInitialized) { |
Copilot
AI
Jul 30, 2025
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.
The static boolean variable isMetalInitialized is not thread-safe. If this function can be called from multiple threads, consider using std::once_flag with std::call_once or adding proper synchronization to prevent race conditions during Metal initialization.
| static bool isMetalInitialized = false; | |
| if (!isMetalInitialized) { | |
| static std::once_flag metalInitFlag; | |
| std::call_once(metalInitFlag, []() { |
| @catch (NSException*) { | ||
| // Ignore any Metal initialization exceptions |
Copilot
AI
Jul 30, 2025
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.
Catching all NSException types without specifying the exception type or logging the error could hide important debugging information. Consider logging the exception details or catching more specific exception types to aid in troubleshooting Metal initialization issues.
| @catch (NSException*) { | |
| // Ignore any Metal initialization exceptions | |
| @catch (NSException* exception) { | |
| // Log Metal initialization exceptions for debugging purposes | |
| NSLog(@"Metal initialization failed with exception: %@ - %@", [exception name], [exception reason]); |
…wnloads and uploads
…ocess and update download/upload actions to latest versions
Suppress Metal initialization errors on macOS by pre-warming graphics context