summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-03-18 10:32:14 +0100
committerGitHub <noreply@github.com>2017-03-18 10:32:14 +0100
commit5b6900ed9beabcd0cdbf339cfc22a05ec865d34a (patch)
tree14fafb11553d5612e6e496569f594a9e11b64ce4 /scene/main
parent27c7d253aa1f2125e37344d7829b5b87a4b9a901 (diff)
parent3f78f1f17db3b80279bd9c4a177913ea36aa130d (diff)
Merge pull request #8014 from AlexHolly/fix-remove-and-skip
fix remove_and_skip()
Diffstat (limited to 'scene/main')
-rwxr-xr-x[-rw-r--r--]scene/main/node.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 0245944154..600dc8737d 100644..100755
--- 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();
}