Преглед изворни кода

Merge pull request #8011 from neikeq/pr-issue-6602-1

Fix connection errors when replacing node
Rémi Verschelde пре 8 година
родитељ
комит
26c12ded24
1 измењених фајлова са 5 додато и 2 уклоњено
  1. 5 2
      scene/main/node.cpp

+ 5 - 2
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);
+		}
 	}
 }