fix a really bad bug using parent instead if this to set children's parent

This commit is contained in:
2017-02-02 22:52:06 +00:00
parent d2f59c3ea1
commit 5df2484c27

View File

@@ -205,8 +205,7 @@ void Node::load_internal(const tinyxml2::XMLElement* x_node)
auto id = const_hash(ids);
auto& ref = (*m_manager)[id];
m_children.push_back(ref.clone());
m_children.back().parent = parent;
m_children.back().m_manager = m_manager;
m_children.back().parent = this;
YGNodeInsertChild(y_node, m_children.back().y_node, YGNodeGetChildCount(y_node));
}
else
@@ -228,6 +227,7 @@ Node Node::clone()
YGNodeCopyStyle(n.y_node, y_node);
if (m_widget)
n.m_widget = m_widget->clone();
n.m_manager = m_manager;
for (auto& c : m_children)
{
n.m_children.push_back(std::move(c.clone()));