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 ff0f003 commit b0d4c71
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 @@ -669,6 +669,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 @@ -226,6 +226,9 @@ TiValueRef TiBindingTiValueFromProxy(TiContextRef 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 b0d4c71

Please sign in to comment.