diff options
author | David Hewitt <1939362+davidhewitt@users.noreply.github.com> | 2019-02-21 09:28:33 +0000 |
---|---|---|
committer | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-02-21 09:28:33 +0000 |
commit | 14e3a0ae5aacb2324d49f995ab6a44ac5c799b2c (patch) | |
tree | d6e12200d46b333a89fae34f7ed455a308de524f /src | |
parent | 66b3f4c877fd7389c5f16c66240e9bf6ea4d596a (diff) | |
download | alacritty-14e3a0ae5aacb2324d49f995ab6a44ac5c799b2c.tar.gz alacritty-14e3a0ae5aacb2324d49f995ab6a44ac5c799b2c.zip |
Fix panic on exit with ConPTY
Even though the `ClosePseudoConsole` API does not have a return
value, it was incorrectly queried by the `Drop` implementation for
the ConPTY, leading to a panic on exit.
The definition of this call has been updated to match the actual
function signatures, which resolve this problem.
Diffstat (limited to 'src')
-rw-r--r-- | src/tty/windows/conpty.rs | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/tty/windows/conpty.rs b/src/tty/windows/conpty.rs index 755846e8..f3c6cf5b 100644 --- a/src/tty/windows/conpty.rs +++ b/src/tty/windows/conpty.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::{process_should_exit, Pty, HANDLE}; +use super::{Pty, HANDLE}; use std::i16; use std::mem; @@ -56,7 +56,7 @@ struct ConptyApi { CreatePseudoConsole: unsafe extern "system" fn(COORD, HANDLE, HANDLE, DWORD, *mut HPCON) -> HRESULT, ResizePseudoConsole: unsafe extern "system" fn(HPCON, COORD) -> HRESULT, - ClosePseudoConsole: unsafe extern "system" fn(HPCON) -> HRESULT, + ClosePseudoConsole: unsafe extern "system" fn(HPCON), } impl ConptyApi { @@ -95,20 +95,7 @@ pub type ConptyHandle = Arc<Conpty>; impl Drop for Conpty { fn drop(&mut self) { - // The pseusdoconsole might already have been closed by the console process exiting. - // ClosePseudoConsole will fail with error code 1 in that case. - // - // This check should be sufficient to avoid that. - if !process_should_exit() { - let result = unsafe { (self.api.ClosePseudoConsole)(self.handle) }; - - // As noted above, if the pseudoconsole is already closed then - // ClosePseudoConsole will fail with the error code 1. - // (This was not in the MSDN docs as of Nov 2018.) - // - // If ClosePseudoConsole is successful then result is S_OK. - assert!(result == S_OK); - } + unsafe { (self.api.ClosePseudoConsole)(self.handle) } } } |