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
This commit is contained in:
Devin Binnie 2023-05-04 13:37:33 -04:00 committed by GitHub
parent 574c4e98a7
commit d685762ac7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
});
}
}