From 3f78f1f17db3b80279bd9c4a177913ea36aa130d Mon Sep 17 00:00:00 2001 From: AlexHolly Date: Sun, 12 Mar 2017 18:50:43 +0100 Subject: [PATCH] fix remove_and_skip() --- scene/main/node.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) mode change 100644 => 100755 scene/main/node.cpp diff --git a/scene/main/node.cpp b/scene/main/node.cpp old mode 100644 new mode 100755 index 864e26a651c..20c7d8f221d --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2020,12 +2020,13 @@ void Node::remove_and_skip() { bool clear = true; for (int i = 0; i < data.children.size(); i++) { - if (!data.children[i]->get_owner()) + Node *c_node = data.children[i]; + if (!c_node->get_owner()) continue; - remove_child(data.children[i]); - data.children[i]->_propagate_replace_owner(this, NULL); - children.push_back(data.children[i]); + remove_child(c_node); + c_node->_propagate_replace_owner(this, NULL); + children.push_back(c_node); clear = false; break; } @@ -2036,9 +2037,9 @@ void Node::remove_and_skip() { while (!children.empty()) { - Node *c = children.front()->get(); - data.parent->add_child(c); - c->_propagate_replace_owner(NULL, new_owner); + Node *c_node = children.front()->get(); + data.parent->add_child(c_node); + c_node->_propagate_replace_owner(NULL, new_owner); children.pop_front(); }