From bc8e9ca14f12c76f43f322ad6a266b92c23ca21f Mon Sep 17 00:00:00 2001
From: Joerg Bornemann <joerg.bornemann@digia.com>
Date: Fri, 11 Apr 2014 08:48:57 +0200
Subject: [PATCH] process_ctrlc_stub: close process and thread handles

There's no need to keep those handles open throughout the
lifetime of the stub.

Change-Id: I27dd1f26edc1ccd150b913a7f38bab70d8b10763
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
---
 src/libs/utils/process_ctrlc_stub.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/libs/utils/process_ctrlc_stub.cpp b/src/libs/utils/process_ctrlc_stub.cpp
index 6f6905f931e..f4179f267ea 100644
--- a/src/libs/utils/process_ctrlc_stub.cpp
+++ b/src/libs/utils/process_ctrlc_stub.cpp
@@ -165,6 +165,7 @@ DWORD WINAPI processWatcherThread(LPVOID lpParameter)
     DWORD dwExitCode;
     if (!GetExitCodeProcess(hProcess, &dwExitCode))
         dwExitCode = -1;
+    CloseHandle(hProcess);
     PostMessage(hwndMain, WM_DESTROY, dwExitCode, 0);
     return 0;
 }
@@ -185,6 +186,7 @@ bool startProcess(wchar_t *pCommandLine)
         fwprintf(stderr, L"qtcreator_ctrlc_stub: Command line failed: %s\n", pCommandLine);
         return false;
     }
+    CloseHandle(pi.hThread);
 
     HANDLE hThread = CreateThread(NULL, 0, processWatcherThread, reinterpret_cast<void*>(pi.hProcess), 0, NULL);
     if (!hThread) {
-- 
GitLab