[gtk+] bin: initialize out variables to zero for get_preferred_ functions.



commit aa08f4d8f5ed60e3fe9e4bd970493582411c25c4
Author: Alban Browaeys <prahal yahoo com>
Date:   Mon Mar 4 16:22:00 2013 +0100

    bin: initialize out variables to zero for get_preferred_ functions.
    
    Fixes case of child not visible then minimum_width/heigth natural_width
    /heigth not initialized. Thus caller gets a random value.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695131

 gtk/gtkbin.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
index c52ca37..b64f541 100644
--- a/gtk/gtkbin.c
+++ b/gtk/gtkbin.c
@@ -198,6 +198,9 @@ gtk_bin_get_preferred_width (GtkWidget *widget,
   GtkBinPrivate *priv = bin->priv;
   gint border_width;
 
+  *minimum_width = 0;
+  *natural_width = 0;
+
   if (priv->child && gtk_widget_get_visible (priv->child))
     {
       gint child_min, child_nat;
@@ -221,6 +224,9 @@ gtk_bin_get_preferred_height (GtkWidget *widget,
   GtkBinPrivate *priv = bin->priv;
   gint border_width;
 
+  *minimum_height = 0;
+  *natural_height = 0;
+
   if (priv->child && gtk_widget_get_visible (priv->child))
     {
       gint child_min, child_nat;
@@ -245,6 +251,9 @@ gtk_bin_get_preferred_width_for_height (GtkWidget *widget,
   GtkBinPrivate *priv = bin->priv;
   gint border_width;
 
+  *minimum_width = 0;
+  *natural_width = 0;
+
   border_width = gtk_bin_get_effective_border_width (bin);
 
   if (priv->child && gtk_widget_get_visible (priv->child))
@@ -271,6 +280,9 @@ gtk_bin_get_preferred_height_for_width  (GtkWidget *widget,
   GtkBinPrivate *priv = bin->priv;
   gint border_width;
 
+  *minimum_height = 0;
+  *natural_height = 0;
+
   border_width = gtk_bin_get_effective_border_width (bin);
 
   if (priv->child && gtk_widget_get_visible (priv->child))


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