[glib] gobject: Use a destructor rather than g_atexit() for refcount debugging
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gobject: Use a destructor rather than g_atexit() for refcount debugging
- Date: Wed, 15 Feb 2012 14:58:44 +0000 (UTC)
commit ab59739e1177d463fc7577def059deb0179662cc
Author: Dan Winship <danw gnome org>
Date: Fri Feb 10 08:24:28 2012 -0500
gobject: Use a destructor rather than g_atexit() for refcount debugging
https://bugzilla.gnome.org/show_bug.cgi?id=669671
gobject/gobject.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 88fb7ef..69f14a8 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -33,6 +33,7 @@
#include "gparamspecs.h"
#include "gvaluetypes.h"
#include "gobject_trace.h"
+#include "gconstructor.h"
/**
* SECTION:objects
@@ -329,6 +330,13 @@ debug_objects_foreach (gpointer key,
object->ref_count);
}
+#ifdef G_HAS_CONSTRUCTORS
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(debug_objects_atexit)
+#endif
+G_DEFINE_DESTRUCTOR(debug_objects_atexit)
+#endif /* G_HAS_CONSTRUCTORS */
+
static void
debug_objects_atexit (void)
{
@@ -387,7 +395,9 @@ _g_object_type_init (void)
IF_DEBUG (OBJECTS)
{
debug_objects_ht = g_hash_table_new (g_direct_hash, NULL);
+#ifndef G_HAS_CONSTRUCTORS
g_atexit (debug_objects_atexit);
+#endif /* G_HAS_CONSTRUCTORS */
}
#endif /* G_ENABLE_DEBUG */
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]