Skip to content

Commit

Permalink
fix: freeeze on macos when save window's state
Browse files Browse the repository at this point in the history
  • Loading branch information
0x-jerry committed Oct 30, 2024
1 parent 00086e0 commit 03dd6f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src-tauri/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ use tauri_plugin_window_state::{AppHandleExt, StateFlags};
use crate::{conf::AppConfigExt, proxy::set_proxy, v2fly::FlyStateExt};

pub fn before_exit_app<R: Runtime>(app: &AppHandle<R>) {
let _ = app.save_window_state(StateFlags::all());
let handle = app.clone();

let _ = app.run_on_main_thread(move || {
// this should run on main thread, otherwise, the whole app will freeze on MacOS
let _ = handle.save_window_state(StateFlags::all());
});

let mut conf = app.app_config();

Expand Down

0 comments on commit 03dd6f8

Please sign in to comment.