From fbf94c3a41e7b6cd9924d64ef0ea76c9aa17aebe Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Tue, 27 Oct 2026 18:09:39 +0800 Subject: [PATCH] refactor(core): drop unreachable hotkey dtor and dedupe tray predicate Remove impl Drop for Hotkey: the instance lives in a OnceLock static via the singleton! macro and is never dropped; exit-time unregistration is already handled by Hotkey::reset(). Spell the include_proxy_groups/display-mode predicate identically at both evaluation sites in tray menu building; behavior is unchanged (Option != Some("disable") is equivalent to unwrap_or("default") != "disable"). --- src-tauri/src/core/hotkey.rs | 9 --------- src-tauri/src/core/tray/mod.rs | 3 ++- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src-tauri/src/core/hotkey.rs b/src-tauri/src/core/hotkey.rs index 75027d176..d23ae2a57 100755 --- a/src-tauri/src/core/hotkey.rs +++ b/src-tauri/src/core/hotkey.rs @@ -466,12 +466,3 @@ impl Hotkey { (del_list, add_list) } } - -impl Drop for Hotkey { - fn drop(&mut self) { - let app_handle = handle::Handle::app_handle(); - if let Err(e) = app_handle.global_shortcut().unregister_all() { - logging!(error, Type::Hotkey, "Error unregistering all hotkeys: {:?}", e); - } - } -} diff --git a/src-tauri/src/core/tray/mod.rs b/src-tauri/src/core/tray/mod.rs index ae8c63c2c..f7fa4a6d6 100644 --- a/src-tauri/src/core/tray/mod.rs +++ b/src-tauri/src/core/tray/mod.rs @@ -636,7 +636,8 @@ async fn create_tray_menu( .tray_proxy_groups_display_mode .as_deref() .unwrap_or("default"); - let include_proxy_groups = options.include_proxy_groups && tray_proxy_groups_display_mode != "disable"; + let include_proxy_groups = + options.include_proxy_groups && verge_settings.tray_proxy_groups_display_mode.as_deref() != Some("disable"); let proxy_group_order_map = runtime_proxy_groups_order;