mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-17 15:36:43 +00:00
Since the native menu bar (#894), Quit runs file.exit, which closes the window through eframe while AppKit's run loop is still going. AppKit's Touch Bar finder then removes a KVO observer from the already-deallocated view in the next display cycle (`-[_NSTouchBarFinderObservation invalidate]`): an uncaught exception that aborts on macOS 27 (#1458) and leaves a windowless app on macOS 26 (#1575). The window's close button took the same path before #894; ⌘Q used winit's default menu, which calls terminate:. Every way of leaving (Quit, ⌘Q, the close button, the OS quit event, app.quit) arrives at guard_window_close as a close request. Once leaving is settled (nothing unsaved, or the prompt answered) it now runs Services::quit when the platform has one, keeping the window open for it. On macOS that is -[NSApplication terminate:], scheduled on the main queue so winit is out of its event handler and eframe's exiting hook still saves the window layout. Reproduced in a macOS 26.6.2 VM with XCUITest: on main, Quit, Quit with a document, ⌘Q and the close button abort with the #1458 stack; with this change all of them exit, write no crash report and save ui.ron. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>