[gnome-builder] tree: add counter for tree nodes



commit 921a0ba34c4f05a0160168a69df282c81624386a
Author: Christian Hergert <chergert redhat com>
Date:   Wed Oct 14 16:16:30 2015 -0700

    tree: add counter for tree nodes
    
    A little bit of help to ensure we don't leak these things at runtime.
    Especially since a lot of them can potentially be made.

 src/tree/gb-tree-node.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/tree/gb-tree-node.c b/src/tree/gb-tree-node.c
index 67c3b41..a4a5fb9 100644
--- a/src/tree/gb-tree-node.c
+++ b/src/tree/gb-tree-node.c
@@ -20,6 +20,8 @@
 
 #include <glib/gi18n.h>
 
+#include "egg-counter.h"
+
 #include "gb-tree.h"
 #include "gb-tree-node.h"
 #include "gb-tree-private.h"
@@ -47,6 +49,7 @@ typedef struct
 } PopupRequest;
 
 G_DEFINE_TYPE (GbTreeNode, gb_tree_node, G_TYPE_INITIALLY_UNOWNED)
+EGG_DEFINE_COUNTER (instances, "GbTreeNode", "Instances", "Number of GbTreeNode instances")
 
 enum {
   PROP_0,
@@ -523,6 +526,8 @@ gb_tree_node_finalize (GObject *object)
     }
 
   G_OBJECT_CLASS (gb_tree_node_parent_class)->finalize (object);
+
+  EGG_COUNTER_DEC (instances);
 }
 
 static void
@@ -725,6 +730,8 @@ gb_tree_node_class_init (GbTreeNodeClass *klass)
 static void
 gb_tree_node_init (GbTreeNode *node)
 {
+  EGG_COUNTER_INC (instances);
+
   node->needs_build = TRUE;
 }
 


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