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); } }