Skip to content

Return getConcreteSharedProps() by value - #59957

Open
lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-59944-concrete-shared-props
Open

lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-59944-concrete-shared-props

Conversation

@lazerg

@lazerg lazerg commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Summary:

ConcreteShadowNode::getConcreteSharedProps() returned const std::shared_ptr<const ConcreteProps> & to the result of std::static_pointer_cast, which is a temporary, so every caller got a reference to a shared_ptr that was already destroyed. It now returns the shared_ptr by value. Callers that copy the result, like auto props = node.getConcreteSharedProps(), don't need to change. I regenerated the C++ API snapshots for the new signature.

Fixes #59944

Changelog:

[GENERAL] [FIXED] - ConcreteShadowNode::getConcreteSharedProps() no longer returns a dangling reference

Test Plan:

I compiled the reproducer from the issue against ConcreteShadowNode.h with clang and -Wreturn-stack-address. Before the change, clang warns "returning reference to local temporary object" at ConcreteShadowNode.h:147. After the change there is no warning. I ran python -m scripts.cxx-api.parser and the only change to the ConcreteShadowNode snapshot entries is the getConcreteSharedProps() line.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 12, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 12, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ConcreteShadowNode::getConcreteSharedProps() returns a reference to a temporary

1 participant