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

Commit

Permalink
bugfix ios 8.11.1 multithreading crash by eagle destroy instance
Browse files Browse the repository at this point in the history
  • Loading branch information
pengtaopt committed Sep 16, 2019
1 parent 8a6c6fa commit 263521e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
21 changes: 1 addition & 20 deletions ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
Expand Up @@ -792,26 +792,7 @@ - (void)destroyInstance:(NSString *)instance
}

WXSDKInstance *sdkInstance = [WXSDKManager instanceForID:instance];
if (sdkInstance.dataRender) {
if (_dataRenderHandler) {
WXPerformBlockOnComponentThread(^{
[_dataRenderHandler destroyDataRenderInstance:instance];
WXPerformBlockOnBridgeThreadForInstance(^{
[self callJSMethod:@"destroyInstance" args:@[instance]];
}, instance);
});
}
else {
WXComponentManager *manager = sdkInstance.componentManager;
if (manager.isValid) {
WXSDKErrCode errorCode = WX_KEY_EXCEPTION_DEGRADE_EAGLE_RENDER_ERROR;
NSError *error = [NSError errorWithDomain:WX_ERROR_DOMAIN code:errorCode userInfo:@{@"message":@"No data render handler found!"}];
WXPerformBlockOnComponentThread(^{
[manager renderFailed:error];
});
}
}
} else {
if (!sdkInstance.wlasmRender) {
[self callJSMethod:@"destroyInstance" args:@[instance]];
}
}
Expand Down
2 changes: 1 addition & 1 deletion weex-playground
Expand Up @@ -55,6 +55,10 @@ void CoreSideInPlatform::SetDefaultHeightAndWidthIntoRootDom(
}

void CoreSideInPlatform::OnInstanceClose(const std::string &instance_id) {
auto handler = EagleBridge::GetInstance()->data_render_handler();
if (handler) {
handler->DestroyInstance(instance_id.c_str());
}
RenderManager::GetInstance()->ClosePage(instance_id);
}

Expand Down

0 comments on commit 263521e

Please sign in to comment.