Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,18 @@ public static void Quit(int exitCode)
{
if (Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow?.Close();
// IMPORTANT (especially on macOS):
// App shutdown must go through a single path only.
//
// The launcher runs with `ShutdownMode.OnMainWindowClose`, so calling
// `MainWindow.Close()` already starts the application shutdown sequence.
// If we then also call `desktop.Shutdown(...)`, we re-enter teardown
// from a second path while native resources (AppKit/Avalonia dispatcher)
// are already being finalized.
//
// In practice this has caused terminate/exit-time crashes on macOS
// (SIGABRT around NSApplication terminate + dispatcher cleanup).
// Therefore, `Quit()` must call only `desktop.Shutdown(exitCode)`.
desktop.Shutdown(exitCode);
}
else
Expand Down