[gjs/mem-track: 1/5] gjs: keep track of all JS contexts



commit 24b30fd7c8c17368e5454c0369a7018fa38d28b7
Author: Tommi Komulainen <tko litl com>
Date:   Mon Jan 26 14:05:22 2009 +0000

    gjs: keep track of all JS contexts
---
 gjs/context.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/gjs/context.c b/gjs/context.c
index eee03fe..89184c2 100644
--- a/gjs/context.c
+++ b/gjs/context.c
@@ -71,6 +71,8 @@ struct _GjsContextClass {
 
 G_DEFINE_TYPE(GjsContext, gjs_context, G_TYPE_OBJECT);
 
+static GSList *all_gjs_contexts = NULL;
+
 #if 0
 enum {
     LAST_SIGNAL
@@ -239,6 +241,8 @@ gjs_context_dispose(GObject *object)
         js_context->profiler = NULL;
     }
 
+    all_gjs_contexts = g_slist_remove(all_gjs_contexts, js_context);
+
     if (js_context->global != NULL) {
         JS_RemoveRoot(js_context->context, &js_context->global);
         js_context->global = NULL;
@@ -546,6 +550,8 @@ gjs_context_constructor (GType                  type,
     all_contexts = g_list_prepend(all_contexts, object);
     g_static_mutex_unlock (&contexts_lock);
 
+    all_gjs_contexts = g_slist_prepend(all_gjs_contexts, js_context);
+
     return object;
 }
 



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