diff options
| author | Ignacio Etcheverry | 2017-03-11 20:21:04 +0100 |
|---|---|---|
| committer | Ignacio Etcheverry | 2017-03-11 20:21:04 +0100 |
| commit | d210ac66ef8bbe056c014ba90fd2a12611b51648 (patch) | |
| tree | b51fb4e604411356743d8a6cb379dcb4395ac771 /scene/main/node.cpp | |
| parent | b043f0e77dac613e8af0484642333f116d87be6c (diff) | |
| download | godot-d210ac66ef8bbe056c014ba90fd2a12611b51648.tar.gz godot-d210ac66ef8bbe056c014ba90fd2a12611b51648.tar.zst godot-d210ac66ef8bbe056c014ba90fd2a12611b51648.zip | |
Fix connection errors when replacing node
- Avoid connecting the signals to nonexistent methods
- Preserve only persistent connections
Diffstat (limited to '')
| -rw-r--r-- | scene/main/node.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 864e26a65..024594415 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); + } } } |
