[gimp] app: keep GimpCanvasItem from emitting "update" during destruction



commit 2e209ac4407ad237dca197543102ef215ea09691
Author: Michael Natterer <mitch gimp org>
Date:   Sat Jun 10 22:00:38 2017 +0200

    app: keep GimpCanvasItem from emitting "update" during destruction
    
    Simply increase its change_count in dispose(). There is really no
    reason to build expensive update regions and emitting signals when we
    are about to go away.

 app/display/gimpcanvasitem.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/app/display/gimpcanvasitem.c b/app/display/gimpcanvasitem.c
index 8d9e2bc..7d13d22 100644
--- a/app/display/gimpcanvasitem.c
+++ b/app/display/gimpcanvasitem.c
@@ -67,6 +67,7 @@ struct _GimpCanvasItemPrivate
 
 /*  local function prototypes  */
 
+static void             gimp_canvas_item_dispose          (GObject         *object);
 static void             gimp_canvas_item_constructed      (GObject         *object);
 static void             gimp_canvas_item_set_property     (GObject         *object,
                                                            guint            property_id,
@@ -105,6 +106,7 @@ gimp_canvas_item_class_init (GimpCanvasItemClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
+  object_class->dispose                     = gimp_canvas_item_dispose;
   object_class->constructed                 = gimp_canvas_item_constructed;
   object_class->set_property                = gimp_canvas_item_set_property;
   object_class->get_property                = gimp_canvas_item_get_property;
@@ -190,6 +192,16 @@ gimp_canvas_item_constructed (GObject *object)
 }
 
 static void
+gimp_canvas_item_dispose (GObject *object)
+{
+  GimpCanvasItem *item = GIMP_CANVAS_ITEM (object);
+
+  item->private->change_count++; /* avoid emissions during destruction */
+
+  G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
 gimp_canvas_item_set_property (GObject      *object,
                                guint         property_id,
                                const GValue *value,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]