diff --git a/ReactCommon/react/renderer/uimanager/UIManager.cpp b/ReactCommon/react/renderer/uimanager/UIManager.cpp index 8455efb45ed..27172099150 100644 --- a/ReactCommon/react/renderer/uimanager/UIManager.cpp +++ b/ReactCommon/react/renderer/uimanager/UIManager.cpp @@ -22,6 +22,13 @@ 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 +// properly across dynamic library boundaries (i.e. dynamic_cast that is used by +// isHostObject method) +ShadowNodeWrapper::~ShadowNodeWrapper() = default; +ShadowNodeListWrapper::~ShadowNodeListWrapper() = default; + static std::unique_ptr constructLeakCheckerIfNeeded( RuntimeExecutor const &runtimeExecutor) { #ifdef REACT_NATIVE_DEBUG diff --git a/ReactCommon/react/renderer/uimanager/primitives.h b/ReactCommon/react/renderer/uimanager/primitives.h index 101155f91af..cc2f925a5f1 100644 --- a/ReactCommon/react/renderer/uimanager/primitives.h +++ b/ReactCommon/react/renderer/uimanager/primitives.h @@ -30,6 +30,11 @@ struct ShadowNodeWrapper : public jsi::HostObject { ShadowNodeWrapper(SharedShadowNode 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; }; @@ -37,6 +42,11 @@ struct ShadowNodeListWrapper : public jsi::HostObject { ShadowNodeListWrapper(SharedShadowNodeUnsharedList shadowNodeList) : shadowNodeList(shadowNodeList) {} + // 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) + ~ShadowNodeListWrapper() override; + SharedShadowNodeUnsharedList shadowNodeList; };