summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Policht <michpolicht@gmail.com>2016-01-16 17:20:56 +0100
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-02-18 08:56:25 +0000
commiteba6912e17320cfb8e9b2f963932ad8d968191b3 (patch)
tree71db1727fab27d6e34fa185bef79cb32514bfdf5
parent998c2a73804aa24c38c1c21bab38a95407459a73 (diff)
downloadqt-creator-eba6912e17320cfb8e9b2f963932ad8d968191b3.tar.gz
Fix qtcreator_process_stub "cannot obtain a handle to the inferior" issue.
Don't close the process/thread handles, so that the kernel doesn't free the resources before ConsoleProcess is able to obtain handles to them - this would be a problem if the child process exits very quickly. Also remove the superfluous free(env) for consistency. Task-number: QTCREATORBUG-13042 Change-Id: Ie25eeab71cd9dfd69831c37e4f02477446486309 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
-rw-r--r--src/libs/utils/process_stub_win.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libs/utils/process_stub_win.c b/src/libs/utils/process_stub_win.c
index 9162bf0b1c..0e3a1cce67 100644
--- a/src/libs/utils/process_stub_win.c
+++ b/src/libs/utils/process_stub_win.c
@@ -219,9 +219,11 @@ int main()
if (WaitForSingleObject(pi.hProcess, INFINITE) == WAIT_FAILED)
systemError("Wait for debugee failed, error %d\n");
- CloseHandle(pi.hProcess);
- CloseHandle(pi.hThread);
- free(env);
+
+ /* Don't close the process/thread handles, so that the kernel doesn't free
+ the resources before ConsoleProcess is able to obtain handles to them
+ - this would be a problem if the child process exits very quickly. */
doExit(0);
+
return 0;
}