From 1adbafe95073ffcd2fc31dea578781ee7e219604 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Fri, 3 May 2019 04:56:28 -0700 Subject: [PATCH] Fix `YGConfig` constructors Summary: @public `YGConfig::YGConfig(YGConfig*)` was not initializing the same fields as the default constructors. Here, we make the default constructor delegate to the more specialized one to remove duplication. Reviewed By: SidharthGuglani Differential Revision: D15164599 fbshipit-source-id: 27247709091b7664386057d09ac67d481877871f --- yoga/YGNode.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/yoga/YGNode.h b/yoga/YGNode.h index 021c3372..e43dc9d8 100644 --- a/yoga/YGNode.h +++ b/yoga/YGNode.h @@ -45,7 +45,7 @@ private: uint32_t lineIndex_ = 0; YGNodeRef owner_ = nullptr; YGVector children_ = {}; - YGConfigRef config_ = nullptr; + YGConfigRef config_; std::array resolvedDimensions_ = { {YGValueUndefined, YGValueUndefined}}; @@ -66,16 +66,17 @@ private: using CompactValue = facebook::yoga::detail::CompactValue; public: - YGNode() + YGNode() : YGNode{nullptr} {} + explicit YGNode(const YGConfigRef newConfig) : hasNewLayout_{true}, isReferenceBaseline_{false}, isDirty_{false}, nodeType_{YGNodeTypeDefault}, measureUsesContext_{false}, baselineUsesContext_{false}, - printUsesContext_{false} {} + printUsesContext_{false}, + config_{newConfig} {}; ~YGNode() = default; // cleanup of owner/children relationships in YGNodeFree - explicit YGNode(const YGConfigRef newConfig) : config_(newConfig){}; YGNode(YGNode&&);