fix: manage setup Mutex crash (#3995)

* Revert "Revert "refactor: Replace std::sync::Mutex with parking_lot::Mutex for improved performance and consistency in multiple files" (#3990)"

This reverts commit 667844aa12.

* refactor: Manage lightweight state in the app setup and clean up unused proxy client code

* refactor: Move macOS-specific Manager import under conditional compilation
This commit is contained in:
Tunglies
2025-07-06 02:14:48 +08:00
committed by GitHub
parent 667844aa12
commit ac3afe4dee
4 changed files with 27 additions and 135 deletions

View File

@@ -13,10 +13,8 @@ use crate::AppHandleManager;
use anyhow::{Context, Result};
use delay_timer::prelude::TaskBuilder;
use std::sync::{
atomic::{AtomicBool, Ordering},
Mutex,
};
use parking_lot::Mutex;
use std::sync::atomic::{AtomicBool, Ordering};
use tauri::{Listener, Manager};
const LIGHT_WEIGHT_TASK_UID: &str = "light_weight_task";
@@ -30,7 +28,7 @@ where
{
let app_handle = handle::Handle::global().app_handle().unwrap();
let state = app_handle.state::<Mutex<LightWeightState>>();
let mut guard = state.lock().unwrap();
let mut guard = state.lock();
f(&mut guard)
}