gjs r157 - in trunk: gi gjs
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: gjs r157 - in trunk: gi gjs
- Date: Mon, 9 Feb 2009 01:40:20 +0000 (UTC)
Author: johan
Date: Mon Feb 9 01:40:19 2009
New Revision: 157
URL: http://svn.gnome.org/viewvc/gjs?rev=157&view=rev
Log:
Bug 570964 â Race when shutting down a context, r=hp
Modified:
trunk/gi/object.c
trunk/gjs/jsapi-util.c
trunk/gjs/jsapi-util.h
Modified: trunk/gi/object.c
==============================================================================
--- trunk/gi/object.c (original)
+++ trunk/gi/object.c Mon Feb 9 01:40:19 2009
@@ -559,7 +559,15 @@
runtime = data;
- context = gjs_runtime_get_load_context(runtime);
+ /* The JSContext will be gone if runtime is being destroyed.
+ * In that case we effectively already converted to a weak ref without
+ * doing anything since the keep alive will be collected.
+ * Or if !is_last_ref, we do not want to convert to a strong
+ * ref since we want everything collected on runtime destroy.
+ */
+ context = gjs_runtime_peek_load_context(runtime);
+ if (!context)
+ return;
obj = peek_js_obj(context, gobj);
Modified: trunk/gjs/jsapi-util.c
==============================================================================
--- trunk/gjs/jsapi-util.c (original)
+++ trunk/gjs/jsapi-util.c Mon Feb 9 01:40:19 2009
@@ -82,7 +82,7 @@
return gjs_context_get_context(context);
}
-static JSContext*
+JSContext*
gjs_runtime_peek_load_context(JSRuntime *runtime)
{
GjsContext *context;
Modified: trunk/gjs/jsapi-util.h
==============================================================================
--- trunk/gjs/jsapi-util.h (original)
+++ trunk/gjs/jsapi-util.h Mon Feb 9 01:40:19 2009
@@ -101,6 +101,7 @@
void *data,
GDestroyNotify dnotify);
JSContext* gjs_runtime_get_load_context (JSRuntime *runtime);
+JSContext* gjs_runtime_peek_load_context (JSRuntime *runtime);
void gjs_runtime_clear_load_context (JSRuntime *runtime);
JSContext* gjs_runtime_get_call_context (JSRuntime *runtime);
void gjs_runtime_clear_call_context (JSRuntime *runtime);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]