[gtk+] Fix preconditions in set_max_content_size setters



commit dce4003c20bfd0a5100bd60dc0e923277b89684b
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jun 7 16:35:06 2016 -0400

    Fix preconditions in set_max_content_size setters
    
    We must allow resetting the properties to -1.

 gtk/gtkscrolledwindow.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 1fbf189..0534c93 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -4488,7 +4488,7 @@ gtk_scrolled_window_set_min_content_width (GtkScrolledWindow *scrolled_window,
 
   priv = scrolled_window->priv;
 
-  g_return_if_fail (priv->max_content_width == -1 || width <= priv->max_content_width);
+  g_return_if_fail (width == -1 || priv->max_content_width == -1 || width <= priv->max_content_width);
 
   if (priv->min_content_width != width)
     {
@@ -4542,7 +4542,7 @@ gtk_scrolled_window_set_min_content_height (GtkScrolledWindow *scrolled_window,
 
   priv = scrolled_window->priv;
 
-  g_return_if_fail (priv->max_content_height == -1 || height <= priv->max_content_height);
+  g_return_if_fail (height == -1 || priv->max_content_height == -1 || height <= priv->max_content_height);
 
   if (priv->min_content_height != height)
     {
@@ -4626,7 +4626,7 @@ gtk_scrolled_window_set_max_content_width (GtkScrolledWindow *scrolled_window,
 
   priv = scrolled_window->priv;
 
-  g_return_if_fail (priv->min_content_width == -1 || width >= priv->min_content_width);
+  g_return_if_fail (width == -1 || priv->min_content_width == -1 || width >= priv->min_content_width);
 
   if (width != priv->max_content_width)
     {
@@ -4678,7 +4678,7 @@ gtk_scrolled_window_set_max_content_height (GtkScrolledWindow *scrolled_window,
 
   priv = scrolled_window->priv;
 
-  g_return_if_fail (priv->min_content_height == -1 || height >= priv->min_content_height);
+  g_return_if_fail (height == -1 || priv->min_content_height == -1 || height >= priv->min_content_height);
 
   if (height != priv->max_content_height)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]