Fix problem quitting terminal window while Change Settings active
authorowen <owen@cda61777-01e9-0310-a592-d414129be87e>
Thu, 19 Jun 2003 23:04:50 +0000 (23:04 +0000)
committerowen <owen@cda61777-01e9-0310-a592-d414129be87e>
Thu, 19 Jun 2003 23:04:50 +0000 (23:04 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@3280 cda61777-01e9-0310-a592-d414129be87e

winmisc.c

index caafd7d..916e988 100644 (file)
--- a/winmisc.c
+++ b/winmisc.c
@@ -47,6 +47,7 @@ int SaneDialogBox(HINSTANCE hinst,
     MSG msg;
     int flags;
     int ret;
+    int gm;
 
     wc.style = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW;
     wc.lpfnWndProc = DefDlgProc;
@@ -65,7 +66,7 @@ int SaneDialogBox(HINSTANCE hinst,
     SetWindowLong(hwnd, BOXFLAGS, 0); /* flags */
     SetWindowLong(hwnd, BOXRESULT, 0); /* result from SaneEndDialog */
 
-    while (GetMessage(&msg, NULL, 0, 0)) {
+    while ((gm=GetMessage(&msg, NULL, 0, 0)) > 0) {
        flags=GetWindowLong(hwnd, BOXFLAGS);
        if (!(flags & DF_END) && !IsDialogMessage(hwnd, &msg))
            DispatchMessage(&msg);
@@ -73,6 +74,9 @@ int SaneDialogBox(HINSTANCE hinst,
            break;
     }
 
+    if (gm == 0)
+        PostQuitMessage(msg.wParam); /* We got a WM_QUIT, pass it on */
+
     ret=GetWindowLong(hwnd, BOXRESULT);
     DestroyWindow(hwnd);
     return ret;