GtkBox: Fix self-assignment for center widget

This is happening when glade is loading ui files containing
center widgets.
This commit is contained in:
Matthias Clasen 2014-10-25 20:27:18 -04:00
parent 1376c6b1b7
commit 8b6457732f

View File

@ -2616,17 +2616,22 @@ gtk_box_set_center_widget (GtkBox *box,
GtkWidget *widget)
{
GtkBoxPrivate *priv = box->priv;
GtkWidget *old_center = NULL;
g_return_if_fail (GTK_IS_BOX (box));
if (priv->center)
{
old_center = g_object_ref (priv->center->widget);
gtk_box_remove (GTK_CONTAINER (box), priv->center->widget);
priv->center = NULL;
}
if (widget)
priv->center = gtk_box_pack (box, widget, FALSE, TRUE, 0, GTK_PACK_START);
if (old_center)
g_object_unref (old_center);
}
/**