mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
fix use out-of-scope memory warning (#41441)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41441 changelog: [internal] Reviewed By: cipolleschi Differential Revision: D51233760 fbshipit-source-id: 5fc7ab22220e3d80729243e715e22e85e3ba7afa
This commit is contained in:
committed by
Facebook GitHub Bot
parent
caed1dc230
commit
f1925c2668
@@ -156,10 +156,7 @@ class ConcreteComponentDescriptor : public ComponentDescriptor {
|
||||
ShadowNodeFamily::Shared createFamily(
|
||||
const ShadowNodeFamilyFragment& fragment) const override {
|
||||
return std::make_shared<ShadowNodeFamily>(
|
||||
ShadowNodeFamilyFragment{
|
||||
fragment.tag, fragment.surfaceId, fragment.instanceHandle},
|
||||
eventDispatcher_,
|
||||
*this);
|
||||
fragment, eventDispatcher_, *this);
|
||||
}
|
||||
|
||||
SharedEventEmitter createEventEmitter(
|
||||
|
||||
@@ -28,14 +28,11 @@ class State;
|
||||
* about a `ShadowNodeFamily`. Pelase define specific purpose containers in
|
||||
* those cases.
|
||||
*
|
||||
* Note: All of the fields are `const &` references (essentially just raw
|
||||
* pointers) which means that the Fragment does not copy/store them nor
|
||||
* retain ownership of them.
|
||||
*/
|
||||
struct ShadowNodeFamilyFragment {
|
||||
const Tag tag;
|
||||
const SurfaceId surfaceId;
|
||||
const InstanceHandle::Shared& instanceHandle;
|
||||
const std::shared_ptr<const InstanceHandle> instanceHandle;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -291,8 +291,8 @@ ShadowTree::ShadowTree(
|
||||
layoutConstraints,
|
||||
layoutContext);
|
||||
|
||||
const auto fragment = ShadowNodeFamilyFragment{surfaceId, surfaceId, nullptr};
|
||||
auto family = globalRootComponentDescriptor->createFamily(fragment);
|
||||
auto family = globalRootComponentDescriptor->createFamily(
|
||||
{surfaceId, surfaceId, nullptr});
|
||||
|
||||
auto rootShadowNode = std::static_pointer_cast<const RootShadowNode>(
|
||||
globalRootComponentDescriptor->createShadowNode(
|
||||
|
||||
@@ -76,9 +76,8 @@ std::shared_ptr<ShadowNode> UIManager::createNode(
|
||||
|
||||
PropsParserContext propsParserContext{surfaceId, *contextContainer_.get()};
|
||||
|
||||
const auto fragment =
|
||||
ShadowNodeFamilyFragment{tag, surfaceId, instanceHandle};
|
||||
auto family = componentDescriptor.createFamily(fragment);
|
||||
auto family =
|
||||
componentDescriptor.createFamily({tag, surfaceId, instanceHandle});
|
||||
const auto props =
|
||||
componentDescriptor.cloneProps(propsParserContext, nullptr, rawProps);
|
||||
const auto state = componentDescriptor.createInitialState(props, family);
|
||||
|
||||
Reference in New Issue
Block a user