From a4eeafe6cbb33c8bc0e788b792c40377d8f7b205 Mon Sep 17 00:00:00 2001 From: 4gray Date: Mon, 16 Dec 2024 23:58:17 +0100 Subject: [PATCH] fix(media): prevent process termination on Windows for close_mpv_process function --- src-tauri/src/commands/media.rs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src-tauri/src/commands/media.rs b/src-tauri/src/commands/media.rs index 6574fcc22..2dcf99640 100644 --- a/src-tauri/src/commands/media.rs +++ b/src-tauri/src/commands/media.rs @@ -125,6 +125,8 @@ pub async fn close_mpv_process( process_id: u32, app_handle: tauri::AppHandle, ) -> Result<(), String> { + #[cfg(windows)] + return Err("Process termination is not supported on Windows".to_string()); if let Some(process) = MPV_PROCESSES.lock().unwrap().remove(&process_id) { #[cfg(unix)] { @@ -133,17 +135,6 @@ pub async fn close_mpv_process( } } - #[cfg(windows)] - { - unsafe { - let handle = OpenProcess(PROCESS_TERMINATE, 0, process_id); - if !handle.is_null() { - TerminateProcess(handle, 1); - CloseHandle(handle); - } - } - } - // Updated event emission app_handle .emit("mpv-process-removed", process)