fix: app will crash when it is quiting from Dock (#2271)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2026-04-16 14:18:13 +08:00
parent 5a35c41517
commit 3c747494a8

View File

@@ -473,6 +473,17 @@ namespace SourceGit
_launcher = new ViewModels.Launcher(startupRepo);
desktop.MainWindow = new Views.Launcher() { DataContext = _launcher };
desktop.ShutdownMode = ShutdownMode.OnExplicitShutdown;
// Fix macOS crash when quiting from Dock
if (OperatingSystem.IsMacOS())
{
desktop.ShutdownRequested += (_, e) =>
{
e.Cancel = true;
Dispatcher.UIThread.Post(() => Quit(0));
};
}
desktop.Exit += (_, _) =>
{
_ipcChannel?.Dispose();