Skip to content

Commit 2d07005

Browse files
committed
fix(ios): delay release engine resource to avoid deadlock (#4090)
1 parent ca3967f commit 2d07005

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

framework/ios/base/executors/HippyJSExecutor.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,12 @@ - (void)invalidate {
249249
return;
250250
}
251251
dispatch_async(dispatch_get_main_queue(), ^{
252+
auto engineRsc = [[HippyJSEnginesMapper defaultInstance] JSEngineResourceForKey:enginekey];
252253
[[HippyJSEnginesMapper defaultInstance] removeEngineResourceForKey:enginekey];
254+
dispatch_async(dispatch_get_main_queue(), ^{
255+
// Make a tiny delay to ensure the engine resource is released on the main thread
256+
HippyLogInfo(@"Remove EngineRsc, UseCount:%ld", engineRsc.use_count());
257+
});
253258
});
254259
}
255260

0 commit comments

Comments
 (0)