David Hedberg : comdlg32: Only attempt to update the layout if the dialog window exists.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Apr 1 10:40:59 CDT 2015


Module: wine
Branch: master
Commit: 2afbf9dbbcc56f686c35be03557cabf9589b1a03
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2afbf9dbbcc56f686c35be03557cabf9589b1a03

Author: David Hedberg <david.hedberg at gmail.com>
Date:   Sun Mar 29 22:56:29 2015 +0200

comdlg32: Only attempt to update the layout if the dialog window exists.

---

 dlls/comdlg32/itemdlg.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c
index c37b66e..b5093b8 100644
--- a/dlls/comdlg32/itemdlg.c
+++ b/dlls/comdlg32/itemdlg.c
@@ -1225,7 +1225,7 @@ static HRESULT init_custom_controls(FileDialogImpl *This)
 /**************************************************************************
  * Window related functions.
  */
-static SIZE update_layout(FileDialogImpl *This)
+static void update_layout(FileDialogImpl *This)
 {
     HDWP hdwp;
     HWND hwnd;
@@ -1233,21 +1233,19 @@ static SIZE update_layout(FileDialogImpl *This)
     RECT cancel_rc, open_rc;
     RECT filetype_rc, filename_rc, filenamelabel_rc;
     RECT toolbar_rc, ebrowser_rc, customctrls_rc;
-    int missing_width, missing_height;
     static const UINT vspacing = 4, hspacing = 4;
-    SIZE ret;
+    static const UINT min_width = 320, min_height = 200;
 
-    GetClientRect(This->dlg_hwnd, &dialog_rc);
-
-    missing_width = max(0, 320 - dialog_rc.right);
-    missing_height = max(0, 200 - dialog_rc.bottom);
+    if (!GetClientRect(This->dlg_hwnd, &dialog_rc))
+    {
+        TRACE("Invalid dialog window, not updating layout\n");
+        return;
+    }
 
-    if(missing_width || missing_height)
+    if(dialog_rc.right < min_width || dialog_rc.bottom < min_height)
     {
-        TRACE("Missing (%d, %d)\n", missing_width, missing_height);
-        ret.cx = missing_width;
-        ret.cy = missing_height;
-        return ret;
+        TRACE("Dialog size (%d, %d) too small, not updating layout\n", dialog_rc.right, dialog_rc.bottom);
+        return;
     }
 
     /****
@@ -1399,8 +1397,7 @@ static SIZE update_layout(FileDialogImpl *This)
     else
         ERR("Failed to position dialog controls.\n");
 
-    ret.cx = 0; ret.cy = 0;
-    return ret;
+    return;
 }
 
 static HRESULT init_explorerbrowser(FileDialogImpl *This)




More information about the wine-cvs mailing list