* [iOS] add instance destroyState declaring the need for destroy in javaScript
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/1f1dc67d Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/1f1dc67d Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/1f1dc67d Branch: refs/heads/master Commit: 1f1dc67d690a66ebbf9af18a0d95b72b39686ffb Parents: b5a21f9 Author: acton393 <[email protected]> Authored: Tue Feb 6 14:50:00 2018 +0800 Committer: acton393 <[email protected]> Committed: Tue Feb 6 14:50:00 2018 +0800 ---------------------------------------------------------------------- ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1f1dc67d/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m index da7625f..3043ca9 100644 --- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m +++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m @@ -69,7 +69,8 @@ typedef enum : NSUInteger { WXComponentManager *_componentManager; WXRootView *_rootView; WXThreadSafeMutableDictionary *_moduleEventObservers; - BOOL _performanceCommit; + BOOL _performanceCommit; + BOOL _needDestroy; } - (void)dealloc @@ -214,7 +215,7 @@ typedef enum : NSUInteger { [[NSNotificationCenter defaultCenter] postNotificationName:WX_SDKINSTANCE_WILL_RENDER object:self]; [self _handleConfigCenter]; - + _needDestroy = YES; [WXTracingManager startTracingWithInstanceId:self.instanceId ref:nil className:nil name:WXTExecJS phase:WXTracingBegin functionName:@"renderWithMainBundleString" options:@{@"threadName":WXTMainThread}]; [[WXSDKManager bridgeMgr] createInstance:self.instanceId template:mainBundleString options:dictionary data:_jsData]; [WXTracingManager startTracingWithInstanceId:self.instanceId ref:nil className:nil name:WXTExecJS phase:WXTracingEnd functionName:@"renderWithMainBundleString" options:@{@"threadName":WXTMainThread}]; @@ -369,7 +370,9 @@ typedef enum : NSUInteger { [WXPrerenderManager removePrerenderTaskforUrl:[self.scriptURL absoluteString]]; [WXPrerenderManager destroyTask:self.instanceId]; - [[WXSDKManager bridgeMgr] destroyInstance:self.instanceId]; + if (_needDestroy) { + [[WXSDKManager bridgeMgr] destroyInstance:self.instanceId]; + } if (_componentManager) { [_componentManager invalidate];
