Commit 8b645773 authored by Matthias Clasen's avatar Matthias Clasen

GtkBox: Fix self-assignment for center widget

This is happening when glade is loading ui files containing
center widgets.
parent 1376c6b1
...@@ -2616,17 +2616,22 @@ gtk_box_set_center_widget (GtkBox *box, ...@@ -2616,17 +2616,22 @@ gtk_box_set_center_widget (GtkBox *box,
GtkWidget *widget) GtkWidget *widget)
{ {
GtkBoxPrivate *priv = box->priv; GtkBoxPrivate *priv = box->priv;
GtkWidget *old_center = NULL;
g_return_if_fail (GTK_IS_BOX (box)); g_return_if_fail (GTK_IS_BOX (box));
if (priv->center) if (priv->center)
{ {
old_center = g_object_ref (priv->center->widget);
gtk_box_remove (GTK_CONTAINER (box), priv->center->widget); gtk_box_remove (GTK_CONTAINER (box), priv->center->widget);
priv->center = NULL; priv->center = NULL;
} }
if (widget) if (widget)
priv->center = gtk_box_pack (box, widget, FALSE, TRUE, 0, GTK_PACK_START); priv->center = gtk_box_pack (box, widget, FALSE, TRUE, 0, GTK_PACK_START);
if (old_center)
g_object_unref (old_center);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment