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 c24fd94  [iOS]fix crash when call getlayouttime
     new e4740f5  Merge pull request #2858 from jianhan-he/master
c24fd94 is described below

commit c24fd9466bacc425826192c17a0188cafffeaf1f
Author: linghe.lh <[email protected]>
AuthorDate: Thu Aug 29 14:34:54 2019 +0800

    [iOS]fix crash when call getlayouttime
---
 ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m 
b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m
index 36a80f9..4a11f4a 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m
@@ -132,7 +132,14 @@
     [targetComponent.weexInstance.apmInstance 
updateMaxStats:KEY_PAGE_STATS_EXECUTE_JS_TIME curMaxValue:self.callJsTime];
     [targetComponent.weexInstance.apmInstance 
updateMaxStats:KEY_PAGE_STATS_CREATE_COMPONENT_TIME 
curMaxValue:self.componentCreateTime];
     [targetComponent.weexInstance.apmInstance 
updateMaxStats:KEY_PAGE_STATS_CREATE_VIEW_TIME curMaxValue:self.viewCreateTime];
-    [targetComponent.weexInstance.apmInstance 
updateMaxStats:KEY_PAGE_STATS_LAYOUT_TIME curMaxValue:[WXCoreBridge 
getLayoutTime:targetComponent.weexInstance.instanceId]];
+    __weak WXComponent* weakComponent = targetComponent;
+    WXPerformBlockOnComponentThread(^{
+         __strong WXComponent* strongComponent = weakComponent;
+        if (!strongComponent) {
+            return;
+        }
+        [strongComponent.weexInstance.apmInstance 
updateMaxStats:KEY_PAGE_STATS_LAYOUT_TIME curMaxValue:[WXCoreBridge 
getLayoutTime:strongComponent.weexInstance.instanceId]];
+    });
 
     self.interactionTime = self.interactionTime < diff ? diff 
:self.interactionTime;
 }

Reply via email to