Files
ghostty/macos/Sources/Helpers/ObjCExceptionCatcher.h
Mitchell Hashimoto 8696bef644 macos: guard fullscreen tab presentation
#13611

Route new-tab window presentation through an Objective-C exception catcher.

AppKit can raise an NSInternalInconsistencyException while selecting a
new tab in native fullscreen.

Catch the presentation exception, report it through the existing error
logging path, and leave Ghostty running when AppKit’s fullscreen window
stack is inconsistent.

This was pretty hard to reproduce but I was able to reproduce it about
1/3rd of the time via AppleScript automation...
2026-08-05 11:25:18 -07:00

21 lines
634 B
Objective-C

#import <Foundation/Foundation.h>
/// This file contains wrappers around various ObjC functions so we can catch
/// exceptions, since you can't natively catch ObjC exceptions from Swift
/// (at least at the time of writing this comment).
/// NSWindow.addTabbedWindow wrapper
FOUNDATION_EXPORT BOOL GhosttyAddTabbedWindowSafely(
id _Nonnull parent,
id _Nonnull child,
NSInteger ordered,
NSError * _Nullable * _Nullable error
);
/// NSWindowController.showWindow wrapper
FOUNDATION_EXPORT BOOL GhosttyShowWindowSafely(
id _Nonnull controller,
id _Nullable sender,
NSError * _Nullable * _Nullable error
);