mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Fabric: Making UIManager::getNewestCloneOfShadowNode even more safer
Summary: We cannot use a raw pointer here because the tree might progress right after we call to `shadowTree.tryCommit` and we will get a dangling pointer as a result. Changelog: [Internal] Fabric-specific internal change. Reviewed By: mdvacca Differential Revision: D21464832 fbshipit-source-id: 3998b39d29db672da54d4adcb6be55cd3d44d862
This commit is contained in:
1 parent
604402678b
commit
0d2fcb1ed7
1 file changed
+2
-2
@@ -136,12 +136,12 @@ ShadowNode::Shared UIManager::getNewestCloneOfShadowNode(
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
ShadowNode const *ancestorShadowNode;
|
||||
auto ancestorShadowNode = ShadowNode::Shared{};
|
||||
shadowTreeRegistry_.visit(
|
||||
shadowNode.getSurfaceId(), [&](ShadowTree const &shadowTree) {
|
||||
shadowTree.tryCommit(
|
||||
[&](RootShadowNode::Shared const &oldRootShadowNode) {
|
||||
ancestorShadowNode = oldRootShadowNode.get();
|
||||
ancestorShadowNode = oldRootShadowNode;
|
||||
return nullptr;
|
||||
},
|
||||
true);
|
||||
|
||||
Reference in new issue
Block a user