diff options
Diffstat (limited to 'alacritty_terminal')
-rw-r--r-- | alacritty_terminal/Cargo.toml | 2 | ||||
-rw-r--r-- | alacritty_terminal/src/tty/windows/child.rs | 13 | ||||
-rw-r--r-- | alacritty_terminal/src/tty/windows/conpty.rs | 2 |
3 files changed, 9 insertions, 8 deletions
diff --git a/alacritty_terminal/Cargo.toml b/alacritty_terminal/Cargo.toml index 6afa7fef..32e09a72 100644 --- a/alacritty_terminal/Cargo.toml +++ b/alacritty_terminal/Cargo.toml @@ -34,7 +34,7 @@ signal-hook = "0.3.10" [target.'cfg(windows)'.dependencies] piper = "0.2.1" miow = "0.6.0" -windows-sys = { version = "0.52.0", features = [ +windows-sys = { version = "0.59.0", features = [ "Win32_System_Console", "Win32_Foundation", "Win32_Security", diff --git a/alacritty_terminal/src/tty/windows/child.rs b/alacritty_terminal/src/tty/windows/child.rs index dc6b992c..573eb475 100644 --- a/alacritty_terminal/src/tty/windows/child.rs +++ b/alacritty_terminal/src/tty/windows/child.rs @@ -1,6 +1,7 @@ use std::ffi::c_void; use std::io::Error; use std::num::NonZeroU32; +use std::ptr; use std::sync::atomic::{AtomicPtr, Ordering}; use std::sync::{mpsc, Arc, Mutex}; @@ -50,7 +51,7 @@ pub struct ChildExitWatcher { wait_handle: AtomicPtr<c_void>, event_rx: mpsc::Receiver<ChildEvent>, interest: Arc<Mutex<Option<Interest>>>, - child_handle: HANDLE, + child_handle: AtomicPtr<c_void>, pid: Option<NonZeroU32>, } @@ -58,12 +59,12 @@ impl ChildExitWatcher { pub fn new(child_handle: HANDLE) -> Result<ChildExitWatcher, Error> { let (event_tx, event_rx) = mpsc::channel(); - let mut wait_handle: HANDLE = 0; + let mut wait_handle: HANDLE = ptr::null_mut(); let interest = Arc::new(Mutex::new(None)); let sender_ref = Box::new(ChildExitSender { sender: event_tx, interest: interest.clone(), - child_handle: AtomicPtr::from(child_handle as *mut c_void), + child_handle: AtomicPtr::from(child_handle), }); let success = unsafe { @@ -82,11 +83,11 @@ impl ChildExitWatcher { } else { let pid = unsafe { NonZeroU32::new(GetProcessId(child_handle)) }; Ok(ChildExitWatcher { - wait_handle: AtomicPtr::from(wait_handle as *mut c_void), event_rx, interest, - child_handle, pid, + child_handle: AtomicPtr::from(child_handle), + wait_handle: AtomicPtr::from(wait_handle), }) } } @@ -112,7 +113,7 @@ impl ChildExitWatcher { /// If you terminate the process using this handle, the terminal will get a /// timeout error, and the child watcher will emit an `Exited` event. pub fn raw_handle(&self) -> HANDLE { - self.child_handle + self.child_handle.load(Ordering::Relaxed) as HANDLE } /// Retrieve the Process ID associated to the underlying child process. diff --git a/alacritty_terminal/src/tty/windows/conpty.rs b/alacritty_terminal/src/tty/windows/conpty.rs index 28289f90..bcbc1f0e 100644 --- a/alacritty_terminal/src/tty/windows/conpty.rs +++ b/alacritty_terminal/src/tty/windows/conpty.rs @@ -72,7 +72,7 @@ impl ConptyApi { type LoadedFn = unsafe extern "system" fn() -> isize; unsafe { let hmodule = LoadLibraryW(w!("conpty.dll")); - if hmodule == 0 { + if hmodule.is_null() { return None; } let create_fn = GetProcAddress(hmodule, s!("CreatePseudoConsole"))?; |