[gimp/soc-2010-cage] app: include the config objects in the instance debugging



commit 27bd80bf7d3c954f1f1ec74b9bb1309605315e43
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jun 24 22:47:42 2010 +0200

    app: include the config objects in the instance debugging
    
    And indeed, we fail to get rid of them upon exit...

 app/config/gimpbaseconfig.c |   61 ++++++++++++++++++++++++++++++++++--------
 1 files changed, 49 insertions(+), 12 deletions(-)
---
diff --git a/app/config/gimpbaseconfig.c b/app/config/gimpbaseconfig.c
index 28a369f..efee3c8 100644
--- a/app/config/gimpbaseconfig.c
+++ b/app/config/gimpbaseconfig.c
@@ -38,6 +38,8 @@
 #include "gimprc-blurbs.h"
 #include "gimpbaseconfig.h"
 
+#include "gimp-debug.h"
+
 #include "gimp-intl.h"
 
 
@@ -54,21 +56,50 @@ enum
 };
 
 
-static void   gimp_base_config_finalize     (GObject      *object);
-static void   gimp_base_config_set_property (GObject      *object,
-                                             guint         property_id,
-                                             const GValue *value,
-                                             GParamSpec   *pspec);
-static void   gimp_base_config_get_property (GObject      *object,
-                                             guint         property_id,
-                                             GValue       *value,
-                                             GParamSpec   *pspec);
+static void   gimp_base_config_class_init   (GimpBaseConfigClass *klass);
+static void   gimp_base_config_init         (GimpBaseConfig      *config,
+                                             GimpBaseConfigClass *klass);
+static void   gimp_base_config_finalize     (GObject             *object);
+static void   gimp_base_config_set_property (GObject             *object,
+                                             guint                property_id,
+                                             const GValue        *value,
+                                             GParamSpec          *pspec);
+static void   gimp_base_config_get_property (GObject             *object,
+                                             guint                property_id,
+                                             GValue              *value,
+                                             GParamSpec          *pspec);
+
 
+static GObjectClass *parent_class = NULL;
 
-G_DEFINE_TYPE (GimpBaseConfig, gimp_base_config, G_TYPE_OBJECT)
 
-#define parent_class gimp_base_config_parent_class
+GType
+gimp_base_config_get_type (void)
+{
+  static GType config_type = 0;
 
+  if (! config_type)
+    {
+      const GTypeInfo config_info =
+      {
+        sizeof (GimpBaseConfigClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) gimp_base_config_class_init,
+        NULL,           /* class_finalize */
+        NULL,           /* class_data     */
+        sizeof (GimpBaseConfig),
+        0,              /* n_preallocs    */
+        (GInstanceInitFunc) gimp_base_config_init,
+      };
+
+      config_type = g_type_register_static (G_TYPE_OBJECT,
+                                            "GimpBaseConfig",
+                                            &config_info, 0);
+    }
+
+  return config_type;
+}
 
 static void
 gimp_base_config_class_init (GimpBaseConfigClass *klass)
@@ -76,6 +107,8 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   gint          num_processors;
 
+  parent_class = g_type_class_peek_parent (klass);
+
   object_class->finalize     = gimp_base_config_finalize;
   object_class->set_property = gimp_base_config_set_property;
   object_class->get_property = gimp_base_config_get_property;
@@ -120,8 +153,10 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass)
 }
 
 static void
-gimp_base_config_init (GimpBaseConfig *config)
+gimp_base_config_init (GimpBaseConfig      *config,
+                       GimpBaseConfigClass *klass)
 {
+  gimp_debug_add_instance (G_OBJECT (config), G_OBJECT_CLASS (klass));
 }
 
 static void
@@ -132,6 +167,8 @@ gimp_base_config_finalize (GObject *object)
   g_free (base_config->temp_path);
   g_free (base_config->swap_path);
 
+  gimp_debug_remove_instance (object);
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 



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