[gimp] app: unref options->tool_info in dispose() instead of finalize()



commit a5b6544b6e655590e0072103125f2759d3d764e5
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jun 24 12:54:56 2010 +0200

    app: unref options->tool_info in dispose() instead of finalize()

 app/core/gimptooloptions.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimptooloptions.c b/app/core/gimptooloptions.c
index 69c852e..aa3042e 100644
--- a/app/core/gimptooloptions.c
+++ b/app/core/gimptooloptions.c
@@ -50,6 +50,7 @@ enum
 };
 
 
+static void   gimp_tool_options_dispose      (GObject         *object);
 static void   gimp_tool_options_set_property (GObject         *object,
                                               guint            property_id,
                                               const GValue    *value,
@@ -67,12 +68,15 @@ static void   gimp_tool_options_tool_notify  (GimpToolOptions *options,
 
 G_DEFINE_TYPE (GimpToolOptions, gimp_tool_options, GIMP_TYPE_CONTEXT)
 
+#define parent_class gimp_tool_options_parent_class
+
 
 static void
 gimp_tool_options_class_init (GimpToolOptionsClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
+  object_class->dispose      = gimp_tool_options_dispose;
   object_class->set_property = gimp_tool_options_set_property;
   object_class->get_property = gimp_tool_options_get_property;
 
@@ -98,6 +102,20 @@ gimp_tool_options_init (GimpToolOptions *options)
                     NULL);
 }
 
+static void
+gimp_tool_options_dispose (GObject *object)
+{
+  GimpToolOptions *options = GIMP_TOOL_OPTIONS (object);
+
+  if (options->tool_info)
+    {
+      g_object_unref (options->tool_info);
+      options->tool_info = NULL;
+    }
+
+  G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
 /*  This is such a horrible hack, but neccessary because we
  *  a) load an option's tool-info from disk in many cases
  *  b) screwed up in the past and saved the wrong tool-info in some cases



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