fix: prevent lightweight mode exit cleanup (#6973)

close #6973
This commit is contained in:
Tunglies
2026-05-17 00:28:11 +08:00
parent fc2ff69bdb
commit 07cbecb01d
+7 -1
View File
@@ -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.