Fix KeyCue-triggered menu accessibility crash on macOS 26.6.2 - #55
Conversation
Allow AppKit's known NSMenu accessibility compatibility exception to reach its framework catch boundary instead of aborting TextMate.
dayglojesus
left a comment
There was a problem hiding this comment.
Thanks @BenjaminX — excellent work all around: a clear crash report, a correct root-cause analysis, and a tightly scoped fix, all inside a day.
The log lines you posted on #54 confirm the guard matches the real crash exactly (-[NSMenu accessibilityPerformAction:], plain NSMenu receiver, two occurrences a minute apart), so this is verified end-to-end. The narrow match plus the existing FSExecutionErrorException precedent makes this an easy approve.
One non-blocking thought for a possible follow-up: since the reason string embeds the receiver's dynamic class, a subclass of NSMenu (e.g. TextMate's own OakMainMenu menu bar) would produce a reason the hasPrefix: check doesn't match. No evidence any AX client hits that path — your crashes both landed on plain NSMenu submenus — but loosening the match to ignore the class name would be cheap insurance if this ever resurfaces.
Merging. Thanks again for the contribution!
Generated by Claude Code
Summary
Root cause
AppKit still routes NSMenu accessibilityPerformShowMenu through the deprecated accessibilityPerformAction: API. On macOS 26.6.2 that path raises NSInvalidArgumentException because the fallback selector is no longer implemented by NSObject. The accessibility entry point catches this framework compatibility exception, but TextMate’s NSExceptionHandler delegate observes it first and calls abort().
The crash is therefore reported as SIGABRT in OakExceptionHandlerDelegate, with the originating accessibility request attributed to KeyCue.
Fix
Recognize only the exact NSInvalidArgumentException reason emitted by this NSMenu path and return without calling abort(), allowing AppKit to reach its own catch boundary. No NSMenu swizzling or broad NSInvalidArgumentException suppression is introduced.
Verification
Crash signature