瀏覽代碼

LibGUI: Fix Action destructor to unregister itself correctly

Changed the Action destructor to fix an issue where global scoped
actions without shortcuts were not being properly unregistered from the
application. Previously, this could cause crashes when attempting to
open the command palette.
Humberto Alves 2 年之前
父節點
當前提交
d50b4f3581
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Userland/Libraries/LibGUI/Action.cpp

+ 1 - 1
Userland/Libraries/LibGUI/Action.cpp

@@ -124,7 +124,7 @@ Action::Action(DeprecatedString text, Shortcut const& shortcut, Shortcut const&
 
 
 Action::~Action()
 Action::~Action()
 {
 {
-    if (m_shortcut.is_valid() && m_scope == ShortcutScope::ApplicationGlobal) {
+    if (m_scope == ShortcutScope::ApplicationGlobal) {
         if (auto* app = Application::the())
         if (auto* app = Application::the())
             app->unregister_global_shortcut_action({}, *this);
             app->unregister_global_shortcut_action({}, *this);
     }
     }