Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
Double11 fix2 (#2937)
Browse files Browse the repository at this point in the history
* [iOS] Fix issue JS thread may be deallocated not in JS thread.

* [iOS] Fix the issue that iOS13 logic not working if config center is not set.
  • Loading branch information
wqyfavor authored and jianhan-he committed Sep 26, 2019
1 parent 344bb3f commit 69cfe53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.mm
Expand Up @@ -80,6 +80,7 @@ - (void)dealloc
{
_jsContext.instanceId = nil;
__block JSContext* theContext = _jsContext;
_jsContext = nil; // Make sure that the context MUST be freed in JS thread.
WXPerformBlockOnBridgeThreadForInstance(^{
theContext = nil; // release the context in js thread to avoid main-thread deadlock
}, _weexInstanceId);
Expand Down
4 changes: 4 additions & 0 deletions ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
Expand Up @@ -606,6 +606,10 @@ - (BOOL)_handleConfigCenter
BOOL alwaysUseMRCForObjectToWeexCore = [[configCenter configForKey:@"iOS_weex_ext_config.alwaysUseMRC" defaultValue:@(NO) isDefault:NULL] boolValue];
ConvertSwitches(isIOS13, useMRCForInvalidJSONObject, alwaysUseMRCForObjectToWeexCore);
}
else {
BOOL isIOS13 = [[[UIDevice currentDevice] systemVersion] integerValue] == 13;
ConvertSwitches(isIOS13, YES, NO);
}
return NO;
}

Expand Down

0 comments on commit 69cfe53

Please sign in to comment.