An application built on gpui-kit intermittently aborts on macOS with an uncaught AppKit exception raised by the Touch Bar finder. No application frames are involved: the throw happens inside AppKit during a display-cycle flush on the main run loop.
Environment
- gpui-kit git revision
86f9c0fb5907549d9a5b0aff53b4b6865933a8e8 (GPUI gpui-pre =0.3.6)
- MacBookPro17,1 (M1, with Touch Bar), macOS 26.6.2
- Window opened with
gpui_kit::open_window and TitleBar::window_options(), a TitleBar in the view, default key bindings and an app menu
Exception
*** Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <_NSTouchBarFinderObservation 0x…> for the key path "nextResponder" from <NSView 0x…> because it is not registered as an observer.'
Top of the exception backtrace:
Foundation -[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:]
Foundation -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:]
Foundation -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:context:]
AppKit -[_NSTouchBarFinderObservation invalidate]
AppKit ___NSTouchBarFinderSetNeedsUpdateOnMain_block_invoke_2
AppKit NSDisplayCycleObserverInvoke
AppKit NSDisplayCycleFlush
QuartzCore CA::Transaction::run_commit_handlers(CATransactionPhase)
QuartzCore CA::Transaction::commit()
...
AppKit -[NSApplication run]
<app> gpui_macos::platform::MacPlatform::run
Reproduction
Rare and timing dependent. It occurred:
- once during normal use of the app, about four minutes after launch, while focus was moving between two instances of the same app;
- once in a single instance while programmatically switching the frontmost app between it and Finder (Accessibility
AXFrontmost), within the first 25 switches.
A further ~320 switches did not reproduce it, neither in the app nor in a minimal gpui_kit::open_window window, so I cannot yet say whether anything specific to the app raises the rate.
Possibly related
An application built on
gpui-kitintermittently aborts on macOS with an uncaught AppKit exception raised by the Touch Bar finder. No application frames are involved: the throw happens inside AppKit during a display-cycle flush on the main run loop.Environment
86f9c0fb5907549d9a5b0aff53b4b6865933a8e8(GPUIgpui-pre =0.3.6)gpui_kit::open_windowandTitleBar::window_options(), aTitleBarin the view, default key bindings and an app menuException
Top of the exception backtrace:
Reproduction
Rare and timing dependent. It occurred:
AXFrontmost), within the first 25 switches.A further ~320 switches did not reproduce it, neither in the app nor in a minimal
gpui_kit::open_windowwindow, so I cannot yet say whether anything specific to the app raises the rate.Possibly related
_NSTouchBarFinderObservationexception on an Intel Touch Bar Mac when closing a window; worked around by hiding windows withorderOut:instead of destroying them.gpui-baseinstallsaccessibilityHitTest:on the window's class viaclass_addMethodinmacos_accessibility.rs; I have not shown that this is involved.