aboutsummaryrefslogtreecommitdiff
path: root/scene/main/node.cpp
diff options
context:
space:
mode:
authorIgnacio Etcheverry2017-03-11 20:21:04 +0100
committerRémi Verschelde2017-03-19 00:38:30 +0100
commit94653f0e8856ff8a969b09398f0e1c3ebd373963 (patch)
treed11c8c4a10dacc204069ffd88e0afd56b93ada33 /scene/main/node.cpp
parentf8db8a3faa30b71dca33ced38be16d3f93f43e8a (diff)
downloadgodot-94653f0e8856ff8a969b09398f0e1c3ebd373963.tar.gz
godot-94653f0e8856ff8a969b09398f0e1c3ebd373963.tar.zst
godot-94653f0e8856ff8a969b09398f0e1c3ebd373963.zip
Fix connection errors when replacing node
- Avoid connecting the signals to nonexistent methods - Preserve only persistent connections (cherry picked from commit d210ac66ef8bbe056c014ba90fd2a12611b51648)
Diffstat (limited to '')
-rw-r--r--scene/main/node.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 8f02de4c4..a6f0833aa 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1795,8 +1795,11 @@ void Node::_replace_connections_target(Node *p_new_target) {
Connection &c = E->get();
- c.source->disconnect(c.signal, this, c.method);
- c.source->connect(c.signal, p_new_target, c.method, c.binds, c.flags);
+ if (c.flags & CONNECT_PERSIST) {
+ c.source->disconnect(c.signal, this, c.method);
+ ERR_CONTINUE(!p_new_target->has_method(c.method));
+ c.source->connect(c.signal, p_new_target, c.method, c.binds, c.flags);
+ }
}
}