fix: windows cannot save window state(2)

This commit is contained in:
huzibaca
2024-11-20 00:27:53 +08:00
parent 95b7641f9c
commit 98c6e0311b
3 changed files with 16 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ use tauri::{AppHandle, Emitter, Manager, WebviewWindow};
#[derive(Debug, Default, Clone)]
pub struct Handle {
pub app_handle: Arc<RwLock<Option<AppHandle>>>,
pub is_exiting: Arc<RwLock<bool>>,
}
impl Handle {
@@ -17,6 +18,7 @@ impl Handle {
HANDLE.get_or_init(|| Handle {
app_handle: Arc::new(RwLock::new(None)),
is_exiting: Arc::new(RwLock::new(false)),
})
}
@@ -68,4 +70,13 @@ impl Handle {
Tray::update_part()?;
Ok(())
}
pub fn set_is_exiting(&self) {
let mut is_exiting = self.is_exiting.write();
*is_exiting = true;
}
pub fn is_exiting(&self) -> bool {
*self.is_exiting.read()
}
}