From e014b913d285f15813b7fc71f469f07780cb655f Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Sat, 17 Oct 2026 09:14:57 +0800 Subject: [PATCH] fix(profile): close switching-flag leak window and drop duplicate busy notice The switching flag was released by a defer registered inside perform_config_update, so a panic during the write-lock wait or the draft edit could leave it stuck set. Register the defer right after the CAS. Skip the generic validation notice for busy switch outcomes; the frontend already shows its own busy toast. --- src-tauri/src/cmd/profile.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src-tauri/src/cmd/profile.rs b/src-tauri/src/cmd/profile.rs index 8c20504e8..3448d1502 100644 --- a/src-tauri/src/cmd/profile.rs +++ b/src-tauri/src/cmd/profile.rs @@ -282,7 +282,9 @@ async fn handle_validation_failure( ) -> CmdResult { logging!(warn, Type::Cmd, "配置验证失败: {}", outcome); discard_and_restore(current_profile).await?; - handle_validation_notice(&outcome, ValidationNoticeTarget::Runtime, "运行时配置"); + if !matches!(outcome, ValidationOutcome::Busy) { + handle_validation_notice(&outcome, ValidationNoticeTarget::Runtime, "运行时配置"); + } Ok(outcome) } @@ -311,9 +313,6 @@ async fn perform_config_update( current_value: Option<&String>, current_profile: Option<&String>, ) -> CmdResult { - defer! { - CURRENT_SWITCHING_PROFILE.store(false, Ordering::Release); - } let update_result = run_profile_config_update_transition(|| CoreManager::global().update_config_forced()).await; match update_result { @@ -409,6 +408,9 @@ pub async fn patch_profiles_config(profiles: ProfileSelection) -> CmdResult