[gimp] app: properly remove the children when a GimpCanvasGroup gets destroyed
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: properly remove the children when a GimpCanvasGroup gets destroyed
- Date: Sat, 10 Jun 2017 20:10:03 +0000 (UTC)
commit d6587795c3f57f4a8999dacb322f935ba30a6f92
Author: Michael Natterer <mitch gimp org>
Date: Sat Jun 10 22:08:09 2017 +0200
app: properly remove the children when a GimpCanvasGroup gets destroyed
Call gimp_canvas_group_remove_item() and don't just unref them, so
their state gets restored and signals get disconnected. They may not
be owned by the group, or have other external references.
app/display/gimpcanvasgroup.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/app/display/gimpcanvasgroup.c b/app/display/gimpcanvasgroup.c
index 5abbe9e..d86b834 100644
--- a/app/display/gimpcanvasgroup.c
+++ b/app/display/gimpcanvasgroup.c
@@ -50,7 +50,7 @@ struct _GimpCanvasGroupPrivate
/* local function prototypes */
-static void gimp_canvas_group_dispose (GObject *object);
+static void gimp_canvas_group_finalize (GObject *object);
static void gimp_canvas_group_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -82,7 +82,7 @@ gimp_canvas_group_class_init (GimpCanvasGroupClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpCanvasItemClass *item_class = GIMP_CANVAS_ITEM_CLASS (klass);
- object_class->dispose = gimp_canvas_group_dispose;
+ object_class->finalize = gimp_canvas_group_finalize;
object_class->set_property = gimp_canvas_group_set_property;
object_class->get_property = gimp_canvas_group_get_property;
@@ -116,17 +116,18 @@ gimp_canvas_group_init (GimpCanvasGroup *group)
}
static void
-gimp_canvas_group_dispose (GObject *object)
+gimp_canvas_group_finalize (GObject *object)
{
GimpCanvasGroup *group = GIMP_CANVAS_GROUP (object);
+ GimpCanvasItem *item;
- if (group->priv->items)
- {
- g_queue_free_full (group->priv->items, (GDestroyNotify) g_object_unref);
- group->priv->items = NULL;
- }
+ while ((item = g_queue_peek_head (group->priv->items)))
+ gimp_canvas_group_remove_item (group, item);
+
+ g_queue_free (group->priv->items);
+ group->priv->items = NULL;
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]