]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Merge branch 'pre-0.64'
authorSimon Tatham <anakin@pobox.com>
Sat, 7 Feb 2015 12:50:31 +0000 (12:50 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 7 Feb 2015 12:50:31 +0000 (12:50 +0000)
windows/winhandl.c

index b15d1f2620066b4fb4596a418477a26dfac11770..6b129ad886591c4fb9d5dd73c9935ede24089b9f 100644 (file)
@@ -171,8 +171,10 @@ static DWORD WINAPI handle_input_threadfunc(void *param)
            break;
 
        WaitForSingleObject(ctx->ev_from_main, INFINITE);
-       if (ctx->done)
+       if (ctx->done) {
+            SetEvent(ctx->ev_to_main);
            break;                     /* main thread told us to shut down */
+        }
     }
 
     if (povl)
@@ -627,8 +629,8 @@ void handle_got_event(HANDLE event)
            /*
             * EOF, or (nearly equivalently) read error.
             */
-           h->u.i.gotdata(h, NULL, -h->u.i.readerr);
            h->u.i.defunct = TRUE;
+           h->u.i.gotdata(h, NULL, -h->u.i.readerr);
        } else {
            backlog = h->u.i.gotdata(h, h->u.i.buffer, h->u.i.len);
            handle_throttle(&h->u.i, backlog);
@@ -649,8 +651,8 @@ void handle_got_event(HANDLE event)
             * and mark the thread as defunct (because the output
             * thread is terminating by now).
             */
-           h->u.o.sentdata(h, -h->u.o.writeerr);
            h->u.o.defunct = TRUE;
+           h->u.o.sentdata(h, -h->u.o.writeerr);
        } else {
            bufchain_consume(&h->u.o.queued_data, h->u.o.lenwritten);
            h->u.o.sentdata(h, bufchain_size(&h->u.o.queued_data));