Skip to content

fix: prevent editor delegate crashes on macOS 14 - #187

Open
jkomyno wants to merge 1 commit into
KartikLabhshetwar:mainfrom
jkomyno:fix/editor-window-launch-crash
Open

jkomyno wants to merge 1 commit into
KartikLabhshetwar:mainfrom
jkomyno:fix/editor-window-launch-crash

Conversation

@jkomyno

@jkomyno jkomyno commented Oct 13, 2026

Copy link
Copy Markdown

Prevents the EditorCloseGuard windowDidBecomeKey: launch crash observed with BetterShot 0.5.9 on macOS 14.4.1 (Apple silicon).

AppKit registers delegate notifications using responds(to:) when the guard is attached. During startup-window teardown, SwiftUI releases the original window controller, leaving the guard's weak forwarding target nil; the already-queued editor focus call then delivers a notification the guard cannot handle. Keep the original delegate alive while forwarding is installed, and detach in windowWillClose after forwarding the original delegate's teardown so closed windows cannot retain the controller or send late callbacks to the guard.

The new standalone check covers owner release, notification forwarding, restoration/release on detach, and close-time cleanup followed by a late focus notification. It is discovered by the existing scripts/run-checks.sh runner.

Validation on macOS 14.4.1: the check fails against the original code and passes with this fix. These local runs used a temporary copy of the production file with only its concurrency annotations removed for the installed Swift 5.9 compiler; the committed test compiles the production file directly under the repository's Swift 6 runner. The shipped binary's failure path was also confirmed under LLDB in a temporary diagnostic copy.

Draft pending Xcode 26 validation: make test stops at missing xcodegen, and the available Xcode is 15.0.1. The full patched app, Swift 6 checks, and native editor integration suite have not been built/run. No release or deployment-target changes are included.

@vercel

vercel Bot commented Oct 13, 2026

Copy link
Copy Markdown

@jkomyno is attempting to deploy a commit to the knox projects Team on Vercel.

A member of the Team first needs to authorize it.

@jkomyno
jkomyno marked this pull request as ready for review October 13, 2026 14:41

This branch has not been deployed

No deployments
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.

1 participant