Commit ee5a52da authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Oswald Buddenhagen
Browse files

Process Stub: Release file handle

Task-number: QTCREATORBUG-5382
Merge-request: 388
Reviewed-by: ossi

Change-Id: Ie80fdbe2eadb55d3b5684ebc7a79162317d1a36b
parent 3b48ac33
......@@ -118,6 +118,7 @@ int main()
PROCESS_INFORMATION pi;
DEBUG_EVENT dbev;
enum RunMode mode = Run;
HANDLE image = NULL;
argv = CommandLineToArgvW(GetCommandLine(), &argc);
......@@ -196,6 +197,8 @@ int main()
do {
if (!WaitForDebugEvent (&dbev, INFINITE))
systemError("Cannot fetch debug event, error %d\n");
if (dbev.dwDebugEventCode == CREATE_PROCESS_DEBUG_EVENT)
image = dbev.u.CreateProcessInfo.hFile;
if (dbev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT) {
/* The first exception to be delivered is a trap
which indicates completion of startup. */
......@@ -207,6 +210,8 @@ int main()
} while (dbev.dwDebugEventCode != EXCEPTION_DEBUG_EVENT);
if (!DebugActiveProcessStop(dbev.dwProcessId))
systemError("Cannot detach from debugee, error %d\n");
if (image)
CloseHandle(image);
}
SetConsoleCtrlHandler(ctrlHandler, TRUE);
......@@ -216,6 +221,8 @@ int main()
if (WaitForSingleObject(pi.hProcess, INFINITE) == WAIT_FAILED)
systemError("Wait for debugee failed, error %d\n");
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
doExit(0);
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment