From 8212a9453a173886030ef0cf10a7f43449ed75c4 Mon Sep 17 00:00:00 2001 From: bruno Date: Sun, 26 Jul 2026 13:01:43 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20erreurs=20de=20compilation=20=E2=80=94?= =?UTF-8?q?=20MutexGuard=20Send,=20i32/u32=E2=86=92f64,=20exe=5Fdir=20Opti?= =?UTF-8?q?on,=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - check_backend_health: dropper MutexGuard avant .await (Send bound) - pos.x/y (i32) → as f64, size.width/height (u32) → as f64 - current_exe: .ok().and_then() au lieu de .and_then() (Option vs Result) - Supprimer state_clone unused + _app pour save_window_state --- desktop/src/main.rs | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/desktop/src/main.rs b/desktop/src/main.rs index 4b368e3..853e110 100644 --- a/desktop/src/main.rs +++ b/desktop/src/main.rs @@ -272,13 +272,14 @@ fn restart_backend(state: tauri::State) -> Result) -> Result { - // Check if the backend is actually alive - let mut child_guard = state.child.lock().map_err(|e| e.to_string())?; - let is_alive = match &mut *child_guard { - Some(child) => matches!(child.try_wait(), Ok(None)), - None => false, + // Check if the backend is actually alive (drop guard before await) + let is_alive = { + let mut child_guard = state.child.lock().map_err(|e| e.to_string())?; + match &mut *child_guard { + Some(child) => matches!(child.try_wait(), Ok(None)), + None => false, + } }; - drop(child_guard); if !is_alive { return Ok("dead".to_string()); @@ -293,7 +294,7 @@ async fn check_backend_health(state: tauri::State<'_, BackendProcess>) -> Result #[tauri::command] fn save_window_state( - app: tauri::AppHandle, + _app: tauri::AppHandle, x: f64, y: f64, width: f64, @@ -335,8 +336,9 @@ fn main() { // Resolve exe directory let exe_dir = std::env::current_exe() + .ok() .and_then(|p| p.parent().map(|p| p.to_path_buf())) - .unwrap_or_else(|_| PathBuf::from(".")); + .unwrap_or_else(|| PathBuf::from(".")); info!("Exe dir: {}", exe_dir.display()); // Load config for window state @@ -405,11 +407,6 @@ fn main() { // Wait for backend health check (non-blocking) let handle = app.handle().clone(); - let state = app.state::(); - let state_clone = state.inner().clone(); - // We can't clone state, so we pass the child mutex guard idea - // Instead, we just do the initial health check inline - tauri::async_runtime::spawn(async move { match wait_for_backend().await { Ok(()) => { @@ -482,10 +479,10 @@ fn main() { if let Ok(pos) = window.outer_position() { if let Ok(size) = window.outer_size() { let mut config = load_config(); - config.window_x = Some(pos.x); - config.window_y = Some(pos.y); - config.window_width = Some(size.width); - config.window_height = Some(size.height); + config.window_x = Some(pos.x as f64); + config.window_y = Some(pos.y as f64); + config.window_width = Some(size.width as f64); + config.window_height = Some(size.height as f64); save_config(&config); } }