[seed] Unprotecting functions in closure invalidation should use global context rather than creating a new



commit 24556762de5e203dd4b7e268028e429bfeda8151
Author: Robert Carr <racarr svn gnome org>
Date:   Sun May 10 02:24:25 2009 -0400

    Unprotecting functions in closure invalidation should use global context rather than creating a new context, because this can potentially happen at times where JSCore does not want us creating a new context (i.e. GC wrapper->remove toggle ref->invalidate closure)
---
 libseed/seed-closure.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/libseed/seed-closure.c b/libseed/seed-closure.c
index 6e4e9c7..217aafd 100644
--- a/libseed/seed-closure.c
+++ b/libseed/seed-closure.c
@@ -321,17 +321,14 @@ seed_make_native_closure (JSContextRef ctx,
 static void
 closure_invalidated (gpointer data, GClosure * c)
 {
-  JSContextRef ctx = JSGlobalContextCreateInGroup (context_group,
-						   0);
   SeedClosure *closure = (SeedClosure *) c;
   
   SEED_NOTE (FINALIZATION, "Finalizing closure.");
-  if (closure->user_data && !JSValueIsUndefined(ctx, closure->user_data))
-    JSValueUnprotect(ctx, closure->user_data);
-  if (!JSValueIsUndefined (ctx, closure->function))
-    JSValueUnprotect (ctx, closure->function);
+  if (closure->user_data && !JSValueIsUndefined(eng->context, closure->user_data))
+    JSValueUnprotect(eng->context, closure->user_data);
+  if (!JSValueIsUndefined (eng->context, closure->function))
+    JSValueUnprotect (eng->context, closure->function);
 
-  JSGlobalContextRelease ((JSGlobalContextRef) ctx);
 }
 
 JSObjectRef



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