[gnome-builder] context: track context instances
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] context: track context instances
- Date: Sun, 18 Jun 2017 06:44:12 +0000 (UTC)
commit dba94674eb3f018b284c18912a699a0b4c5458af
Author: Christian Hergert <chergert redhat com>
Date: Sat Jun 17 23:42:58 2017 -0700
context: track context instances
We seem to be leaking a context on unload, so this should help track that
down.
libide/ide-context.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/libide/ide-context.c b/libide/ide-context.c
index 77a65ca..9e2c323 100644
--- a/libide/ide-context.c
+++ b/libide/ide-context.c
@@ -97,8 +97,9 @@ struct _IdeContext
static void async_initable_init (GAsyncInitableIface *);
G_DEFINE_TYPE_EXTENDED (IdeContext, ide_context, G_TYPE_OBJECT, 0,
- G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE,
- async_initable_init))
+ G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_init))
+
+DZL_DEFINE_COUNTER (instances, "Context", "N contexts", "Number of contexts")
enum {
PROP_0,
@@ -564,6 +565,8 @@ ide_context_finalize (GObject *object)
G_OBJECT_CLASS (ide_context_parent_class)->finalize (object);
+ DZL_COUNTER_DEC (instances);
+
_ide_battery_monitor_shutdown ();
IDE_EXIT;
@@ -786,6 +789,8 @@ ide_context_init (IdeContext *self)
{
IDE_ENTRY;
+ DZL_COUNTER_INC (instances);
+
g_mutex_init (&self->unload_mutex);
self->recent_manager = g_object_ref (gtk_recent_manager_get_default ());
@@ -2039,6 +2044,7 @@ ide_context_unload_async (IdeContext *self,
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
task = g_task_new (self, cancellable, callback, user_data);
+ g_task_set_source_tag (task, ide_context_unload_async);
g_mutex_lock (&self->unload_mutex);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]