summaryrefslogtreecommitdiff
path: root/gtk/gtkbutton.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2007-05-10 20:19:38 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2007-05-10 20:19:38 +0000
commit75092d295b554b5e39c41b839810854bed1c5a9e (patch)
treec6fbd6f2981abc5fd2e5a3b5dab2e950cf278db2 /gtk/gtkbutton.c
parent16f9e30bea25eb1286a30b7c1bd61f8c7aafb0b1 (diff)
downloadgtk+-75092d295b554b5e39c41b839810854bed1c5a9e.tar.gz
Unparent the old image before overwriting priv->image. (#437281, Jochen
2007-05-10 Matthias Clasen <mclasen@redhat.com> * gtk/gtkbutton.c (gtk_button_set_image): Unparent the old image before overwriting priv->image. (#437281, Jochen Baier) svn path=/trunk/; revision=17816
Diffstat (limited to 'gtk/gtkbutton.c')
-rw-r--r--gtk/gtkbutton.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 2b0ad37c00..c2729c0432 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -733,7 +733,7 @@ gtk_button_construct_child (GtkButton *button)
image = g_object_ref (priv->image);
if (image->parent)
gtk_container_remove (GTK_CONTAINER (image->parent), image);
-
+
priv->image = NULL;
}
@@ -1970,6 +1970,9 @@ gtk_button_set_image (GtkButton *button,
priv = GTK_BUTTON_GET_PRIVATE (button);
+ if (priv->image && priv->image->parent)
+ gtk_container_remove (GTK_CONTAINER (priv->image->parent), priv->image);
+
priv->image = image;
priv->image_is_stock = (image == NULL);