Repository navigation
fix(app): an AppKit exception no longer aborts the app - #1066
Merged
Merged
Conversation
…anic in full The Mac app aborted about once a week with only "panic in a function that cannot unwind" in app.log. There was no first panic: an NSException that AppKit raised while handling an event (the 2026-11-24 system log shows an NSCampoLightweightUIController assertion during a display reconfiguration) unwound into tao's extern "C" TaoApp sendEvent: override, whose abort-on-unwind landing pad is the app frame the crash report shows right under -[NSApplication _handleEvent:]. - patched tao: both sendEvent: overrides hand the event on inside objc2::exception::catch and log the exception with its stack; the event is dropped, as AppKit's own run loop would. - release profile: panic = "unwind" (under abort neither objc2's catch nor catch_unwind can catch anything). - applog: the panic hook writes the thread and a backtrace (image +offset frames on macOS, the binary is stripped); an exception preprocessor keeps the last Objective-C exception and the hook names it under a cannot-unwind abort; a logger writes tao's caught exceptions; guard() keeps menu, tray, window, page-load, navigation, notification and click-monitor callbacks from ending the app on a panic. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The desktop app aborted about once a week with "panic in a function that cannot unwind" and nothing else in app.log (2026-10-31, 11-06, 11-23, 11-24).
Cause: not a Rust panic. AppKit raised an Objective-C exception (on 11-24 an assertion in NSCampoLightweightUIController during an external display reconfiguration) inside tao's
sendEvent:override, anextern "C"frame. The unwind hit that frame and aborted the app; AppKit would otherwise have logged it and carried on. Confirmed by disassembling the 0.195.0 binary at the crash offset and by a scratch reproduction.Fix:
sendEvent:overrides pass the event on insideobjc2::exception::catch; a caught exception is logged and the event dropped. Guarded by a test so a tao update cannot lose it.panic = "unwind"(required for the catch; arm64 binary 7.0 → 9.2 MB).guard()wraps menu, tray, dock, window, navigation, popover and notification callbacks..ai/21-app.md"An exception in AppKit".cargo fmt, clippy -D warnings, 193 cargo tests pass; release build compiles. Not launched locally by design.