Vyacheslav Andrejev points out a heap management goof in the new jump
[u/mdw/putty] / windows / window.c
index 7cd306d..386f109 100644 (file)
@@ -1973,6 +1973,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
     static int ignore_clip = FALSE;
     static int need_backend_resize = FALSE;
     static int fullscr_on_max = FALSE;
+    static int processed_resize = FALSE;
     static UINT last_mousemove = 0;
 
     switch (message) {
@@ -2756,13 +2757,36 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
                          cfg.win_name_always ? window_name : icon_name);
        if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED)
            SetWindowText(hwnd, window_name);
-        if (wParam == SIZE_RESTORED)
+        if (wParam == SIZE_RESTORED) {
+            processed_resize = FALSE;
             clear_full_screen();
+            if (processed_resize) {
+                /*
+                 * Inhibit normal processing of this WM_SIZE; a
+                 * secondary one was triggered just now by
+                 * clear_full_screen which contained the correct
+                 * client area size.
+                 */
+                return 0;
+            }
+        }
         if (wParam == SIZE_MAXIMIZED && fullscr_on_max) {
             fullscr_on_max = FALSE;
+            processed_resize = FALSE;
             make_full_screen();
+            if (processed_resize) {
+                /*
+                 * Inhibit normal processing of this WM_SIZE; a
+                 * secondary one was triggered just now by
+                 * make_full_screen which contained the correct client
+                 * area size.
+                 */
+                return 0;
+            }
         }
 
+        processed_resize = TRUE;
+
        if (cfg.resize_action == RESIZE_DISABLED) {
            /* A resize, well it better be a minimize. */
            reset_window(-1);
@@ -3380,7 +3404,7 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len,
        if (bold_mode == BOLD_SHADOW && (attr & ATTR_BOLD)) {
            SetBkMode(hdc, TRANSPARENT);
 
-           /* GRR: This draws the character outside it's box and can leave
+           /* GRR: This draws the character outside its box and can leave
             * 'droppings' even with the clip box! I suppose I could loop it
             * one character at a time ... yuk. 
             *