diff --git a/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp b/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp index 5b60ac98428..b84d539ed1c 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp @@ -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 diff --git a/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.h b/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.h index e40321c2574..ea5dae23eeb 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.h +++ b/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.h @@ -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; }; diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp index 949f367117d..1453c3a3c5a 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp @@ -36,10 +36,10 @@ std::unique_ptr 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(