Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dynamic_cast (RTTI) by adding key function to ShadowNodeWrapper again #45290

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -410,4 +410,10 @@ SharedDebugStringConvertibleList ShadowNode::getDebugProps() const {
}
#endif

// Explicitly define destructors here, as they have to exist in order to act as a
// "key function" for the ShadowNodeWrapper class -- this allows for RTTI to work
// properly across dynamic library boundaries (i.e. dynamic_cast that is used by
// getNativeState method)
ShadowNodeWrapper::~ShadowNodeWrapper() = default;

} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ struct ShadowNodeWrapper : public jsi::NativeState {
explicit ShadowNodeWrapper(ShadowNode::Shared shadowNode)
: shadowNode(std::move(shadowNode)) {}

// The below method needs to be implemented out-of-line in order for the class
// to have at least one "key function" (see
// https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-vtable)
~ShadowNodeWrapper() override;

ShadowNode::Shared shadowNode;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ std::unique_ptr<facebook::react::LeakChecker> constructLeakCheckerIfNeeded(

namespace facebook::react {

// Explicitly define destructors here, as they to exist in order to act as a
// "key function" for the ShadowNodeWrapper class -- this allow for RTTI to work
// Explicitly define destructors here, as they have to exist in order to act as a
// "key function" for the ShadowNodeWrapper class -- this allows for RTTI to work
// properly across dynamic library boundaries (i.e. dynamic_cast that is used by
// isHostObject method)
// getNativeState method)
ShadowNodeListWrapper::~ShadowNodeListWrapper() = default;

UIManager::UIManager(
Expand Down
Loading