Draw, MacOS - Fix image generation issue#657
Draw, MacOS - Fix image generation issue#657dpasukhi wants to merge 7 commits intoOpen-Cascade-SAS:IRfrom
Conversation
Suppress Metal initialization errors on macOS by pre-warming graphics context
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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