mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 17:15:38 +08:00
fix: resolve crashes when exiting lightweight mode by ensuring async window operations
This commit is contained in:
@@ -362,7 +362,7 @@ pub fn run() {
|
||||
|
||||
/// Handle application reopen events (macOS)
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn handle_reopen(app_handle: &AppHandle, has_visible_windows: bool) {
|
||||
pub async fn handle_reopen(app_handle: &AppHandle, has_visible_windows: bool) {
|
||||
logging!(
|
||||
info,
|
||||
Type::System,
|
||||
@@ -379,7 +379,7 @@ pub fn run() {
|
||||
|
||||
logging!(info, Type::System, true, "没有可见窗口,尝试显示主窗口");
|
||||
|
||||
let result = WindowManager::show_main_window();
|
||||
let result = WindowManager::show_main_window().await;
|
||||
logging!(
|
||||
info,
|
||||
Type::System,
|
||||
@@ -538,7 +538,10 @@ pub fn run() {
|
||||
has_visible_windows,
|
||||
..
|
||||
} => {
|
||||
event_handlers::handle_reopen(app_handle, has_visible_windows);
|
||||
let app_handle = app_handle.clone();
|
||||
AsyncHandler::spawn(move || async move {
|
||||
event_handlers::handle_reopen(&app_handle, has_visible_windows).await;
|
||||
});
|
||||
}
|
||||
tauri::RunEvent::ExitRequested { api, code, .. } => {
|
||||
if code.is_none() {
|
||||
|
||||
Reference in New Issue
Block a user