diff options
author | Alexander Larsson <alexl@redhat.com> | 2015-06-15 16:32:50 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2015-06-15 16:32:50 +0200 |
commit | 9fc19b5a26e34568c46b90f7cb7357a2898e78b0 (patch) | |
tree | 39f02910e4e2887cef43a39abb0076b3a0341a0d /gtk/gtkoverlay.c | |
parent | 5cf289630833a83cd0ea46063073425e9aaec275 (diff) | |
download | gtk+-9fc19b5a26e34568c46b90f7cb7357a2898e78b0.tar.gz |
gtkoverlay: Fix issues with remove
The iteration now progresses past a delete, so make sure we iterate
safely. Also, don't chain up if we removed a child.
Diffstat (limited to 'gtk/gtkoverlay.c')
-rw-r--r-- | gtk/gtkoverlay.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c index f5962a10bc..eb6ac04177 100644 --- a/gtk/gtkoverlay.c +++ b/gtk/gtkoverlay.c @@ -497,13 +497,14 @@ gtk_overlay_remove (GtkContainer *container, { GtkOverlayPrivate *priv = GTK_OVERLAY (container)->priv; GtkOverlayChild *child; - GSList *children; + GSList *children, *next; gboolean removed; removed = FALSE; - for (children = priv->children; children; children = children->next) + for (children = priv->children; children; children = next) { child = children->data; + next = children->next; if (child->widget == widget) { @@ -524,7 +525,8 @@ gtk_overlay_remove (GtkContainer *container, gtk_widget_child_notify (child->widget, "index"); } - GTK_CONTAINER_CLASS (gtk_overlay_parent_class)->remove (container, widget); + if (!removed) + GTK_CONTAINER_CLASS (gtk_overlay_parent_class)->remove (container, widget); } /** |