[1/2] kernel32: Don't get stuck if the debugger exits without signaling the event.

Francois Gouget fgouget at codeweavers.com
Thu Aug 9 03:39:34 CDT 2007


---

Not exactly the bug I was trying to fix, but it came up while I was 
writing the test in the next patch which includes a very trivial 
debugger.

 dlls/kernel32/except.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/dlls/kernel32/except.c b/dlls/kernel32/except.c
index 32305cb..0817d23 100644
--- a/dlls/kernel32/except.c
+++ b/dlls/kernel32/except.c
@@ -319,7 +319,16 @@ static BOOL	start_debugger(PEXCEPTION_POINTERS epointers, HANDLE hEvent)
     ret = CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, 0, env, NULL, &startup, &info);
     FreeEnvironmentStringsA( env );
 
-    if (ret) WaitForSingleObject(hEvent, INFINITE);  /* wait for debugger to come up... */
+    if (ret)
+    {
+        /* wait for debugger to come up... */
+        HANDLE handles[2];
+        CloseHandle(info.hThread);
+        handles[0]=hEvent;
+        handles[1]=info.hProcess;
+        WaitForMultipleObjects(2, handles, FALSE, INFINITE);
+        CloseHandle(info.hProcess);
+    }
     else ERR("Couldn't start debugger (%s) (%d)\n"
              "Read the Wine Developers Guide on how to set up winedbg or another debugger\n",
              debugstr_a(cmdline), GetLastError());
-- 
1.5.2.4




More information about the wine-patches mailing list