From d685762ac7973682dca86543ac9dd43adc623617 Mon Sep 17 00:00:00 2001 From: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> Date: Thu, 4 May 2023 13:37:33 -0400 Subject: [PATCH] Fix weird macOS crash that occurs when closing the settings window (#2707) * Fix weird macOS crash that occurs when closing the settings window * Added comment --- src/main/windows/settingsWindow.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/windows/settingsWindow.ts b/src/main/windows/settingsWindow.ts index eb7481cc..aa6d4b3a 100644 --- a/src/main/windows/settingsWindow.ts +++ b/src/main/windows/settingsWindow.ts @@ -74,7 +74,10 @@ export class SettingsWindow { this.win.on('closed', () => { delete this.win; - ViewManager.focusCurrentView(); + // For some reason, on macOS, the app will hard crash when the settings window is closed + // It seems to be related to calling view.focus() and there's no log output unfortunately + // Adding this arbitrary delay seems to get rid of it (it happens very frequently) + setTimeout(() => MainWindow.get()?.focus(), 10); }); } }