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
This commit is contained in:
Alban Browaeys 2013-03-04 16:22:00 +01:00 committed by Matthias Clasen
parent d98b4fd0b4
commit aa08f4d8f5

View File

@ -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))