From 07cbecb01d1056fc5b2e6cf84638569ddcf7db99 Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Sun, 17 May 2026 00:07:33 +0800 Subject: [PATCH] fix: prevent lightweight mode exit cleanup (#6973) close #6973 --- src-tauri/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 44a785234..f1f0b7416 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -397,7 +397,13 @@ pub fn run() { } }), #[allow(unused_variables)] - tauri::RunEvent::ExitRequested { api, code, .. } => { + tauri::RunEvent::ExitRequested { api, code, .. } + if module::lightweight::is_in_lightweight_mode() && !handle::Handle::global().is_exiting() => + { + { + api.prevent_exit(); + } + // TODO: Migrate the cleanup logic from RunEvent::Exit to RunEvent::ExitRequested. // This lets us call api.prevent_exit(), run async cleanup first, // and then call app_handle.exit(code) after cleanup has completed.