]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't set negative size when using constraints for layout.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 11 Jul 2010 10:43:53 +0000 (10:43 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 11 Jul 2010 10:43:53 +0000 (10:43 +0000)
Passing negative size to GTK+ results in error messages and in the future
wxWindow::SetSize() itself might assert if passed negative size so just avoid
setting it in the first place even if there is not enough space for
everything.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64881 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/wincmn.cpp

index ac1fbb2f402a04d0194ab109b5ea171d1f5fd422..1c256cbdb760f24bd67ee5e89984f4c9d46636a6 100644 (file)
@@ -2291,7 +2291,9 @@ void wxWindowBase::SetConstraintSizes(bool recurse)
         if ( (constr->width.GetRelationship() != wxAsIs ) ||
              (constr->height.GetRelationship() != wxAsIs) )
         {
-            SetSize(x, y, w, h);
+            // We really shouldn't set negative sizes for the windows so make
+            // them at least of 1*1 size
+            SetSize(x, y, w > 0 ? w : 1, h > 0 ? h : 1);
         }
         else
         {