forked from qt-creator/qt-creator
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 <cristian.adam@qt.io>
This commit is contained in:
18
src/libs/3rdparty/libptyqt/conptyprocess.cpp
vendored
18
src/libs/3rdparty/libptyqt/conptyprocess.cpp
vendored
@@ -570,29 +570,21 @@ void _ClosePseudoConsoleMembers(_In_ PseudoConsole* pPty)
|
|||||||
{
|
{
|
||||||
if (pPty != nullptr)
|
if (pPty != nullptr)
|
||||||
{
|
{
|
||||||
// See MSFT:19918626
|
|
||||||
// First break the signal pipe - this will trigger conhost to tear itself down
|
|
||||||
if (_HandleIsValid(pPty->hSignal))
|
if (_HandleIsValid(pPty->hSignal))
|
||||||
{
|
{
|
||||||
CloseHandle(pPty->hSignal);
|
CloseHandle(pPty->hSignal);
|
||||||
pPty->hSignal = nullptr;
|
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))
|
if (_HandleIsValid(pPty->hPtyReference))
|
||||||
{
|
{
|
||||||
CloseHandle(pPty->hPtyReference);
|
CloseHandle(pPty->hPtyReference);
|
||||||
pPty->hPtyReference = nullptr;
|
pPty->hPtyReference = nullptr;
|
||||||
}
|
}
|
||||||
|
if (_HandleIsValid(pPty->hConPtyProcess))
|
||||||
|
{
|
||||||
|
CloseHandle(pPty->hConPtyProcess);
|
||||||
|
pPty->hConPtyProcess = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user