From 890c99d73969c1bc278052b5c6a4b74005d56d96 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Tue, 18 Feb 2025 08:55:28 +0100 Subject: [PATCH] Terminal: Apply changes from upstream The upstream github.com/microsoft/terminal did change the function and the order in which the handles are closed. This updates our copy of the function to follow those changes. Change-Id: I9eceaa607e63ee4981d06ebc8f3b6920106247da Reviewed-by: Cristian Adam --- src/libs/3rdparty/libptyqt/conptyprocess.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/libs/3rdparty/libptyqt/conptyprocess.cpp b/src/libs/3rdparty/libptyqt/conptyprocess.cpp index 32035f32202..8e9358386ec 100644 --- a/src/libs/3rdparty/libptyqt/conptyprocess.cpp +++ b/src/libs/3rdparty/libptyqt/conptyprocess.cpp @@ -570,29 +570,21 @@ void _ClosePseudoConsoleMembers(_In_ PseudoConsole* pPty) { if (pPty != nullptr) { - // See MSFT:19918626 - // First break the signal pipe - this will trigger conhost to tear itself down if (_HandleIsValid(pPty->hSignal)) { CloseHandle(pPty->hSignal); pPty->hSignal = nullptr; } - // Then, wait on the conhost process before killing it. - // We do this to make sure the conhost finishes flushing any output it - // has yet to send before we hard kill it. - if (_HandleIsValid(pPty->hConPtyProcess)) - { - CloseHandle(pPty->hConPtyProcess); - pPty->hConPtyProcess = nullptr; - } - // Then take care of the reference handle. - // TODO GH#1810: Closing the reference handle late leaves conhost thinking - // that we have an outstanding connected client. if (_HandleIsValid(pPty->hPtyReference)) { CloseHandle(pPty->hPtyReference); pPty->hPtyReference = nullptr; } + if (_HandleIsValid(pPty->hConPtyProcess)) + { + CloseHandle(pPty->hConPtyProcess); + pPty->hConPtyProcess = nullptr; + } } }