Fabric: Fixed possible crash due race condition during Surface unmounting
Summary: @public Now we simply skip `uiManagerDidFinishTransaction` calls if they refer to unregister surfaces. In the future, after we have proper asynchronous scheduling and sync unmounting (and if we chose to have sync unmounting), we can avoid this situation (and assert in this cases). Reviewed By: sahrens Differential Revision: D9652731 fbshipit-source-id: e376ea1ae4f93960a903e6397d843bd7c4b72400
This commit is contained in:
parent
f341541899
commit
10181f31bd
|
@ -91,10 +91,14 @@ void Scheduler::shadowTreeDidCommit(const ShadowTree &shadowTree, const ShadowVi
|
|||
#pragma mark - UIManagerDelegate
|
||||
|
||||
void Scheduler::uiManagerDidFinishTransaction(Tag rootTag, const SharedShadowNodeUnsharedList &rootChildNodes) {
|
||||
const auto &iterator = shadowTreeRegistry_.find(rootTag);
|
||||
const auto &shadowTree = iterator->second;
|
||||
assert(shadowTree);
|
||||
return shadowTree->complete(rootChildNodes);
|
||||
const auto iterator = shadowTreeRegistry_.find(rootTag);
|
||||
if (iterator == shadowTreeRegistry_.end()) {
|
||||
// This might happen during surface unmounting/deallocation process
|
||||
// due to the asynchronous nature of JS calls.
|
||||
return;
|
||||
}
|
||||
|
||||
return iterator->second->complete(rootChildNodes);
|
||||
}
|
||||
|
||||
void Scheduler::uiManagerDidCreateShadowNode(const SharedShadowNode &shadowNode) {
|
||||
|
|
Loading…
Reference in New Issue