[gimp] app: unref tool options and presets in dispose() instead of finalize()



commit 67590c04d19c791fbfd9bd9d75ec313ae52f7e65
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jun 24 12:58:59 2010 +0200

    app: unref tool options and presets in dispose() instead of finalize()

 app/core/gimptoolinfo.c |   35 +++++++++++++++++++++++------------
 1 files changed, 23 insertions(+), 12 deletions(-)
---
diff --git a/app/core/gimptoolinfo.c b/app/core/gimptoolinfo.c
index 2619443..93ffb2c 100644
--- a/app/core/gimptoolinfo.c
+++ b/app/core/gimptoolinfo.c
@@ -45,6 +45,7 @@ enum
 };
 
 
+static void    gimp_tool_info_dispose         (GObject       *object);
 static void    gimp_tool_info_finalize        (GObject       *object);
 static void    gimp_tool_info_get_property    (GObject       *object,
                                                guint          property_id,
@@ -69,6 +70,7 @@ gimp_tool_info_class_init (GimpToolInfoClass *klass)
   GObjectClass      *object_class   = G_OBJECT_CLASS (klass);
   GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
 
+  object_class->dispose           = gimp_tool_info_dispose;
   object_class->finalize          = gimp_tool_info_finalize;
   object_class->get_property      = gimp_tool_info_get_property;
   object_class->set_property      = gimp_tool_info_set_property;
@@ -104,6 +106,27 @@ gimp_tool_info_init (GimpToolInfo *tool_info)
 }
 
 static void
+gimp_tool_info_dispose (GObject *object)
+{
+  GimpToolInfo *tool_info = GIMP_TOOL_INFO (object);
+
+  if (tool_info->tool_options)
+    {
+      g_object_run_dispose (G_OBJECT (tool_info->tool_options));
+      g_object_unref (tool_info->tool_options);
+      tool_info->tool_options = NULL;
+    }
+
+  if (tool_info->presets)
+    {
+      g_object_unref (tool_info->presets);
+      tool_info->presets = NULL;
+    }
+
+  G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
 gimp_tool_info_finalize (GObject *object)
 {
   GimpToolInfo *tool_info = GIMP_TOOL_INFO (object);
@@ -141,18 +164,6 @@ gimp_tool_info_finalize (GObject *object)
       tool_info->help_id = NULL;
     }
 
-  if (tool_info->tool_options)
-    {
-      g_object_unref (tool_info->tool_options);
-      tool_info->tool_options = NULL;
-    }
-
-  if (tool_info->presets)
-    {
-      g_object_unref (tool_info->presets);
-      tool_info->presets = NULL;
-    }
-
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 



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