From 61db5b4fb6e7943a8726f955858c2aba15911dbc Mon Sep 17 00:00:00 2001 From: Louis Pontoise Date: Fri, 24 Apr 2020 12:26:37 +0900 Subject: [PATCH] fix: app could sometimes crash on closing the ui --- src/ui/preferences-window/tabs/GeneralTab.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ui/preferences-window/tabs/GeneralTab.swift b/src/ui/preferences-window/tabs/GeneralTab.swift index 56b4d14e..458e57e8 100644 --- a/src/ui/preferences-window/tabs/GeneralTab.swift +++ b/src/ui/preferences-window/tabs/GeneralTab.swift @@ -80,13 +80,14 @@ class GeneralTab: NSViewController, PreferencePane { App.app.appIsBeingUsed = true } if App.app.appIsBeingUsed { - let isShortcutClosingTheUi = controlId == "holdShortcut" + let isShortcutClosingTheUi = ["holdShortcut", "cancelShortcut"].contains(controlId) if isShortcutClosingTheUi { App.app.appIsBeingUsed = false + App.app.isFirstSummon = true } let fn = shortcutsActionsBlocks[controlId]! let isShortcutAffectingTheUi = ["previousWindowShortcut", "nextWindowShortcut", "←", "→", "holdShortcut"].contains(controlId) - if isShortcutAffectingTheUi { + if isShortcutAffectingTheUi || isShortcutClosingTheUi { DispatchQueue.main.async { () -> () in fn() } } else { fn()