forked from qt-creator/qt-creator
Terminal: Fix freeze when closing terminal on newer Windows 11
Windows 11 24H2 changed the underlying implementation and the "ClosePseudoConsole" code that we copied from the Terminal application didn't work as it did before. The new Terminal releases also removes the WaitForSingleObject call. See https://github.com/microsoft/terminal/pull/17704 We cannot rely on the ConPty API since it doesn't send the "-- resizeQuirk" parameter to "conhost.exe", and the QTCREATORBUG-30007 would be resurrected. Fixes: QTCREATORBUG-32192 Change-Id: Ie21833a1eb21acd0ba21109f3dbc28595b0d94a4 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
committed by
Cristian Adam
parent
8cce192dab
commit
23d28487c4
14
src/libs/3rdparty/libptyqt/conptyprocess.cpp
vendored
14
src/libs/3rdparty/libptyqt/conptyprocess.cpp
vendored
@@ -582,18 +582,6 @@ void _ClosePseudoConsoleMembers(_In_ PseudoConsole* pPty)
|
||||
// has yet to send before we hard kill it.
|
||||
if (_HandleIsValid(pPty->hConPtyProcess))
|
||||
{
|
||||
// If the conhost is already dead, then that's fine. Presumably
|
||||
// it's finished flushing it's output already.
|
||||
DWORD dwExit = 0;
|
||||
// If GetExitCodeProcess failed, it's likely conhost is already dead
|
||||
// If so, skip waiting regardless of whatever error
|
||||
// GetExitCodeProcess returned.
|
||||
// We'll just go straight to killing conhost.
|
||||
if (GetExitCodeProcess(pPty->hConPtyProcess, &dwExit) && dwExit == STILL_ACTIVE)
|
||||
{
|
||||
WaitForSingleObject(pPty->hConPtyProcess, INFINITE);
|
||||
}
|
||||
|
||||
TerminateProcess(pPty->hConPtyProcess, 0);
|
||||
CloseHandle(pPty->hConPtyProcess);
|
||||
pPty->hConPtyProcess = nullptr;
|
||||
@@ -754,7 +742,7 @@ public:
|
||||
typedef HRESULT (*CreatePseudoConsolePtr)(
|
||||
COORD size, // ConPty Dimensions
|
||||
HANDLE hInput, // ConPty Input
|
||||
HANDLE hOutput, // ConPty Output
|
||||
HANDLE hOutput, // ConPty Output
|
||||
DWORD dwFlags, // ConPty Flags
|
||||
HPCON* phPC); // ConPty Reference
|
||||
|
||||
|
Reference in New Issue
Block a user