From f1d2f6248d8f35170734a4e4210f06f243289d2d Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sun, 19 Jul 2026 12:14:09 +0000 Subject: [PATCH 21/71] fix(macos): make the view first responder after the window is on screen The app crashed at launch inside -[NSWindow makeFirstResponder:] (EXC_BAD_ACCESS in objc_msgSendSuper) when it was called before the window was ordered front / made key. Move makeFirstResponder: to after center + makeKeyAndOrderFront + activateIgnoringOtherApps, the ordering AppKit expects. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01AeG2jwYMX5gdvvtUnx3PJa --- src/contour_macos/main.mm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/contour_macos/main.mm b/src/contour_macos/main.mm index c6cde8b7..013411c3 100644 --- a/src/contour_macos/main.mm +++ b/src/contour_macos/main.mm @@ -29,12 +29,15 @@ TerminalView* view = [[TerminalView alloc] initWithFrame:frame fontFamily:@"Menlo" fontSize:14.0]; [_window setContentView:view]; - [_window makeFirstResponder:view]; - [view release]; [_window center]; [_window makeKeyAndOrderFront:nil]; [NSApp activateIgnoringOtherApps:YES]; + + // Make the view first responder after the window is on screen and key. Doing it before + // the window was ordered front crashed inside -[NSWindow makeFirstResponder:] on 10.6. + [_window makeFirstResponder:view]; + [view release]; } - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)app