summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-03-13 11:05:32 +0100
committerGitHub <noreply@github.com>2017-03-13 11:05:32 +0100
commit26c12ded24305703b06e393afd9fbeb0e0cf1128 (patch)
tree6956119d5f12d2d635094578769bd08da68a309e
parentb19b8f72e8768b2a59e09b266ffefced58dd4725 (diff)
parentd210ac66ef8bbe056c014ba90fd2a12611b51648 (diff)
Merge pull request #8011 from neikeq/pr-issue-6602-1
Fix connection errors when replacing node
-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 864e26a651..0245944154 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2498,8 +2498,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);
+ }
}
}