]> git.saurik.com Git - cycript.git/blobdiff - ObjectiveC/Library.mm
Fixed the GC crash of doom that kennytm reported: apparently local contexts come...
[cycript.git] / ObjectiveC / Library.mm
index f578112179051bc2f21d0a724a4652d8cd27a46e..a3c1d66b9b784af87a6995630a59e016a231669c 100644 (file)
@@ -1053,13 +1053,15 @@ JSValueRef CYCastJSValue(JSContextRef context, NSObject *value) { CYPoolTry {
 - (id) initWithJSObject:(JSObjectRef)object inContext:(JSContextRef)context { CYObjectiveTry {
     if ((self = [super init]) != nil) {
         object_ = object;
-        context_ = context;
+        context_ = CYGetJSContext(context);
+        //XXX:JSGlobalContextRetain(context_);
         JSValueProtect(context_, object_);
     } return self;
 } CYObjectiveCatch }
 
 - (void) dealloc { CYObjectiveTry {
     JSValueUnprotect(context_, object_);
+    //XXX:JSGlobalContextRelease(context_);
     [super dealloc];
 } CYObjectiveCatch }
 
@@ -1127,13 +1129,15 @@ JSValueRef CYCastJSValue(JSContextRef context, NSObject *value) { CYPoolTry {
 - (id) initWithJSObject:(JSObjectRef)object inContext:(JSContextRef)context { CYObjectiveTry {
     if ((self = [super init]) != nil) {
         object_ = object;
-        context_ = context;
+        context_ = CYGetJSContext(context);
+        //XXX:JSGlobalContextRetain(context_);
         JSValueProtect(context_, object_);
     } return self;
 } CYObjectiveCatch }
 
 - (void) dealloc { CYObjectiveTry {
     JSValueUnprotect(context_, object_);
+    //XXX:JSGlobalContextRelease(context_);
     [super dealloc];
 } CYObjectiveCatch }
 
@@ -2101,7 +2105,7 @@ static JSValueRef CYValue_callAsFunction_$cya(JSContextRef context, JSObjectRef
         ffi = typical->ffi_;
     }
 
-    return CYMakePointer(context, &internal->value_, type, ffi, object);
+    return CYMakePointer(context, &internal->value_, _not(size_t), type, ffi, object);
 }
 
 static JSValueRef Instance_getProperty_constructor(JSContextRef context, JSObjectRef object, JSStringRef property, JSValueRef *exception) {