Skip to content

Commit

Permalink
[TIMOB-26391] Protect js objects for proxies (#10352)
Browse files Browse the repository at this point in the history
* [TIMOB-26391] Protect js objects for proxies

This will protect js objects temporarily until they are passed back into the js context so they don't get CG'd during the small timeframe of their creation and actual usage.

* [TIMOB-26391] Only guard against GC in JSCore
  • Loading branch information
janvennemann authored and sgtcoolguy committed Sep 27, 2018
1 parent bd716c8 commit 5cc5a6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions iphone/Classes/KrollBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,9 @@ - (id)registerProxy:(id)proxy
#else
ourKrollObject = [[KrollObject alloc] initWithTarget:proxy context:context];
#endif
#ifdef USE_JSCORE_FRAMEWORK
[ourKrollObject protectJsobject];
#endif

[self registerProxy:proxy
krollObject:ourKrollObject];
Expand Down
3 changes: 3 additions & 0 deletions iphone/Classes/TiBindingTiValue.m
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ JSValueRef TiBindingTiValueFromProxy(JSContextRef jsContext, TiProxy *obj)
return [[ourBridge registerProxy:obj] jsobject];
}
KrollObject *objKrollObject = [ourBridge krollObjectForProxy:obj];
#ifdef USE_JSCORE_FRAMEWORK
[objKrollObject unprotectJsobject];
#endif
return [objKrollObject jsobject];
}

Expand Down

0 comments on commit 5cc5a6e

Please sign in to comment.