Skip to content

Avoid preset reads during SwiftUI layout - #87

Merged
didriksg merged 1 commit into
didriksg:mainfrom
dboleslawski:fix/display-preset-crash
Sep 1, 2026
Merged

Avoid preset reads during SwiftUI layout#87
didriksg merged 1 commit into
didriksg:mainfrom
dboleslawski:fix/display-preset-crash

Conversation

@dboleslawski

Copy link
Copy Markdown
Contributor

Summary

  • Cache display presets and the active preset index in DisplayProfileController.reload().
  • Render DisplayPresetView from the cached controller state and update that state after a successful selection.
  • Avoid MonitorPanel KVC reads from SwiftUI view bodies, where nested screen-parameter notifications can re-enter AttributeGraph and trigger a precondition crash.

Split from #86 at reviewer request so the crash fix can land independently.

Testing

  • make check

@didriksg

didriksg commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Verified on my M4 Max MacBook Pro on 26.5.1: the Preset list on the built-in XDR panel renders all eleven entries from the cached snapshot, switching to HDR Video moves the checkmark and the row subtitle, and switching back works. CI, lint and compile are green, merging. One honest note: I couldn't reproduce the nested run loop. A run-loop observer around the MonitorPanel getters (displays, hasPresets, presets, activePreset) shows zero activity and 0 ms with the XDR panel online, so on this machine those reads never pump the loop. If you still have the crash log, I'd like to see it, mostly to learn which macOS version does this. Reading a private framework from inside a view body is wrong either way. Thanks for splitting it out.

@didriksg
didriksg merged commit 74144dc into didriksg:main Sep 1, 2026
1 check passed
didriksg added a commit that referenced this pull request Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants