Skip to content

fix: initialise CoreGraphics before building a window capture filter (cherry-pick for 1.10.0-rc.4) - #490

Merged
EtienneLescot merged 1 commit into
release/v1.10.0from
claude/macos-window-capture-cgs-init-rc4-cherrypick
Aug 23, 2026
Merged

fix: initialise CoreGraphics before building a window capture filter (cherry-pick for 1.10.0-rc.4)#490
EtienneLescot merged 1 commit into
release/v1.10.0from
claude/macos-window-capture-cgs-init-rc4-cherrypick

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Cherry-pick of #488 onto release/v1.10.0, for rc.4.

macOS window capture has never worked: picking any window in the source picker aborts the ScreenCaptureKit helper before it produces a frame, with Assertion failed: (did_initialize), function CGS_REQUIRE_INIT, file CGInitialization.c, line 44. Fixed by touching a CoreGraphics display API (CGMainDisplayID()) at the top of main(), which performs the window-server initialisation SCContentFilter(desktopIndependentWindow:) otherwise needs SkyLight for and never gets in a plain CLI process.

Per the release contract in technical-documentation/engineering/release-and-secrets.md, only the bug-fix commit is cherry-picked here — the follow-up refactor and the manual E2E checklist entry from #488 are docs/refactor changes that stay on main and ship in the next cycle, not on the frozen release branch.

Build and all 22 Swift unit tests verified green on this branch before pushing.

Selecting a window in the source picker aborted the ScreenCaptureKit
helper before it produced a single frame:

    Assertion failed: (did_initialize), function CGS_REQUIRE_INIT,
    file CGInitialization.c, line 44

The helper is a plain command-line executable, so nothing in it ever
connects to the window server. SCContentFilter(desktopIndependentWindow:)
resolves which display a window sits on by calling into SkyLight
(SLSGetDisplaysWithRect), and SkyLight asserts when CoreGraphics was
never initialised in the process.

Display capture is unaffected, because SCContentFilter(display:excludingWindows:)
is handed an already-resolved display and never asks SkyLight to resolve a
rect. That is why only the window branch of makeCaptureTarget crashed.

Touching any CoreGraphics display API performs the initialisation, so a
single CGMainDisplayID() at the top of main() is enough. CoreGraphics is
already imported; this avoids pulling AppKit into the helper or standing
up an NSApplication in a CLI process.
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1cba0e7e-fb60-4bcc-a540-a1287418b256

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@EtienneLescot
EtienneLescot merged commit c9cd061 into release/v1.10.0 Aug 23, 2026
17 checks passed
@EtienneLescot
EtienneLescot deleted the claude/macos-window-capture-cgs-init-rc4-cherrypick branch August 23, 2026 12:03
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