This is an automated email from the ASF dual-hosted git repository. moshen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-weex.git
The following commit(s) were added to refs/heads/master by this push: new 3da1499 [iOS] fix crash when multithread call initSDKEnvironment new 4ea510d Merge pull request #3229 from jianhan-he/master 3da1499 is described below commit 3da1499c4810895255a16b1af9545affe72bea7e Author: linghe.lh <linghe...@alibaba-inc.com> AuthorDate: Thu Jun 18 10:02:58 2020 +0800 [iOS] fix crash when multithread call initSDKEnvironment --- ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m b/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m index 993e427..19ab11a 100644 --- a/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m +++ b/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m @@ -271,23 +271,22 @@ + (void)initSDKEnvironment:(NSString *)script { - WX_MONITOR_PERF_START(WXPTInitalize) - WX_MONITOR_PERF_START(WXPTInitalizeSync) - - if (!script || script.length <= 0) { - NSMutableString *errMsg = [NSMutableString stringWithFormat:@"[WX_KEY_EXCEPTION_SDK_INIT_JSFM_INIT_FAILED] script don't exist:%@",script]; - [WXExceptionUtils commitCriticalExceptionRT:@"WX_KEY_EXCEPTION_SDK_INIT" errCode:[NSString stringWithFormat:@"%d", WX_KEY_EXCEPTION_SDK_INIT] function:@"initSDKEnvironment" exception:errMsg extParams:nil]; - WX_MONITOR_FAIL(WXMTJSFramework, WX_ERR_JSFRAMEWORK_LOAD, errMsg); - return; - } static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ + WX_MONITOR_PERF_START(WXPTInitalize) + WX_MONITOR_PERF_START(WXPTInitalizeSync) + + if (!script || script.length <= 0) { + NSMutableString *errMsg = [NSMutableString stringWithFormat:@"[WX_KEY_EXCEPTION_SDK_INIT_JSFM_INIT_FAILED] script don't exist:%@",script]; + [WXExceptionUtils commitCriticalExceptionRT:@"WX_KEY_EXCEPTION_SDK_INIT" errCode:[NSString stringWithFormat:@"%d", WX_KEY_EXCEPTION_SDK_INIT] function:@"initSDKEnvironment" exception:errMsg extParams:nil]; + WX_MONITOR_FAIL(WXMTJSFramework, WX_ERR_JSFRAMEWORK_LOAD, errMsg); + return; + } [self registerDefaults]; [[WXSDKManager bridgeMgr] executeJsFramework:script]; + + WX_MONITOR_PERF_END(WXPTInitalizeSync) }); - - WX_MONITOR_PERF_END(WXPTInitalizeSync) - } + (void)registerDefaults