diff --git a/src/main.rs b/src/main.rs index eee22d7..855b552 100644 --- a/src/main.rs +++ b/src/main.rs @@ -134,7 +134,7 @@ fn main() { .expect("failed to get initial audio devices and sessions"); let (tx, rx): (Sender, Receiver) = mpsc::channel(); - *WIN_CHANGE_CHANNEL_TX.lock().unwrap().borrow_mut() = Some(tx); + *WIN_CHANGE_CHANNEL_TX.lock().unwrap() = Some(tx); thread::spawn(move || { win_event_hook_loop(); diff --git a/src/window_change.rs b/src/window_change.rs index 895e3d1..618919b 100644 --- a/src/window_change.rs +++ b/src/window_change.rs @@ -1,5 +1,4 @@ use std::{ - cell::RefCell, sync::{mpsc::Sender, Mutex}, }; @@ -18,7 +17,7 @@ use windows::Win32::{ use crate::pid_to_exe::pid_to_exe_path; -pub static WIN_CHANGE_CHANNEL_TX: Mutex>>> = Mutex::new(RefCell::new(None)); +pub static WIN_CHANGE_CHANNEL_TX: Mutex>> = Mutex::new(None); unsafe extern "system" fn win_event_proc( _hook: HWINEVENTHOOK, @@ -40,7 +39,6 @@ unsafe extern "system" fn win_event_proc( WIN_CHANGE_CHANNEL_TX .lock() .unwrap() - .borrow() .as_ref() .unwrap() .send(path)