parent
4d3f6de41a
commit
6deb274b82
|
@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Minimize on windows causing layout issues
|
- Minimize on windows causing layout issues
|
||||||
- Performance bottleneck when clearing colored rows
|
- Performance bottleneck when clearing colored rows
|
||||||
- Vague startup crash messages on Windows with WinPTY backend
|
- Vague startup crash messages on Windows with WinPTY backend
|
||||||
|
- Deadlock on Windows when closing Alacritty using the title bar "X" button (ConPTY backend)
|
||||||
|
|
||||||
## 0.4.0
|
## 0.4.0
|
||||||
|
|
||||||
|
|
|
@ -222,6 +222,19 @@ fn run(window_event_loop: GlutinEventLoop<Event>, config: Config) -> Result<(),
|
||||||
// Start event loop and block until shutdown
|
// Start event loop and block until shutdown
|
||||||
processor.run(terminal, window_event_loop);
|
processor.run(terminal, window_event_loop);
|
||||||
|
|
||||||
|
// This explicit drop is needed for Windows, ConPTY backend. Otherwise a deadlock can occur.
|
||||||
|
// The cause:
|
||||||
|
// - Drop for Conpty will deadlock if the conout pipe has already been dropped.
|
||||||
|
// - The conout pipe is dropped when the io_thread is joined below (io_thread owns pty).
|
||||||
|
// - Conpty is dropped when the last of processor and io_thread are dropped, because both of
|
||||||
|
// them own an Arc<Conpty>.
|
||||||
|
//
|
||||||
|
// The fix is to ensure that processor is dropped first. That way, when io_thread (i.e. pty)
|
||||||
|
// is dropped, it can ensure Conpty is dropped before the conout pipe in the pty drop order.
|
||||||
|
//
|
||||||
|
// FIXME: Change PTY API to enforce the correct drop order with the typesystem.
|
||||||
|
drop(processor);
|
||||||
|
|
||||||
// Shutdown PTY parser event loop
|
// Shutdown PTY parser event loop
|
||||||
loop_tx.send(Msg::Shutdown).expect("Error sending shutdown to pty event loop");
|
loop_tx.send(Msg::Shutdown).expect("Error sending shutdown to pty event loop");
|
||||||
io_thread.join().expect("join io thread");
|
io_thread.join().expect("join io thread");
|
||||||
|
|
|
@ -90,6 +90,10 @@ pub type ConptyHandle = Arc<Conpty>;
|
||||||
|
|
||||||
impl Drop for Conpty {
|
impl Drop for Conpty {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
|
// XXX: This will block until the conout pipe is drained. Will cause a deadlock if the
|
||||||
|
// conout pipe has already been dropped by this point.
|
||||||
|
//
|
||||||
|
// See PR #3084 and https://docs.microsoft.com/en-us/windows/console/closepseudoconsole
|
||||||
unsafe { (self.api.ClosePseudoConsole)(self.handle) }
|
unsafe { (self.api.ClosePseudoConsole)(self.handle) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ pub enum PtyHandle {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Pty {
|
pub struct Pty {
|
||||||
|
// XXX: Handle is required to be the first field, to ensure correct drop order. Dropping
|
||||||
|
// `conout` before `handle` will cause a deadlock.
|
||||||
handle: PtyHandle,
|
handle: PtyHandle,
|
||||||
// TODO: It's on the roadmap for the Conpty API to support Overlapped I/O.
|
// TODO: It's on the roadmap for the Conpty API to support Overlapped I/O.
|
||||||
// See https://github.com/Microsoft/console/issues/262
|
// See https://github.com/Microsoft/console/issues/262
|
||||||
|
|
Loading…
Reference in New Issue