[gjs/gnome-3-8-js17] context: always set GC callback
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/gnome-3-8-js17] context: always set GC callback
- Date: Fri, 5 Apr 2013 23:03:21 +0000 (UTC)
commit 7b238c23e83a34ffd07a6a5e8d84a476f8909b7b
Author: Ray Strode <rstrode redhat com>
Date: Tue Apr 2 16:31:14 2013 -0400
context: always set GC callback
Right now we only set the GC callback if gc-notifications are enabled.
This commit makes us always set the callback as prep work toward fixing a GC
deadlock.
https://bugzilla.gnome.org/show_bug.cgi?id=670200
(cherry picked from commit 7ab5e0e4cc2ddb95f408316607ad96dfc94a3e7b)
gjs/context.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/gjs/context.c b/gjs/context.c
index fd122ee..a77c678 100644
--- a/gjs/context.c
+++ b/gjs/context.c
@@ -665,8 +665,7 @@ gjs_context_constructor (GType type,
js_context->profiler = gjs_profiler_new(js_context->runtime);
- if (js_context->gc_notifications_enabled)
- JS_SetGCCallback(js_context->runtime, gjs_on_context_gc);
+ JS_SetGCCallback(js_context->runtime, gjs_on_context_gc);
JS_EndRequest(js_context->context);
@@ -895,13 +894,20 @@ gjs_on_context_gc (JSRuntime *rt,
JSContext *context = JS_GetRuntimePrivate(rt);
GjsContext *gjs_context = JS_GetContextPrivate(context);
- if (status == JSGC_END) {
- g_mutex_lock(&gc_idle_lock);
- if (gjs_context->idle_emit_gc_id == 0)
- gjs_context->idle_emit_gc_id = g_idle_add (gjs_context_idle_emit_gc, gjs_context);
- g_mutex_unlock(&gc_idle_lock);
+ switch (status) {
+ case JSGC_END:
+ if (gjs_context->gc_notifications_enabled) {
+ g_mutex_lock(&gc_idle_lock);
+ if (gjs_context->idle_emit_gc_id == 0)
+ gjs_context->idle_emit_gc_id = g_idle_add (gjs_context_idle_emit_gc, gjs_context);
+ g_mutex_unlock(&gc_idle_lock);
+ }
+ break;
+
+ default:
+ break;
}
-
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]