Merge pull request #35123 from asynts/asynts.crash-on-double-click

Prevent crash described in #34555.
This commit is contained in:
Rémi Verschelde 2020-01-16 12:32:52 +01:00 committed by GitHub
commit fc2550c4c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -149,6 +149,16 @@ void ConnectDialog::_tree_node_selected() {
get_ok()->set_disabled(false);
}
/*
* Called each time a target node is activated within the target node tree.
*/
void ConnectDialog::_tree_item_activated() {
if (!get_ok()->is_disabled()) {
get_ok()->emit_signal("pressed");
}
}
/*
* Adds a new parameter bind to connection.
*/
@ -212,6 +222,7 @@ void ConnectDialog::_bind_methods() {
ClassDB::bind_method("_advanced_pressed", &ConnectDialog::_advanced_pressed);
ClassDB::bind_method("_cancel", &ConnectDialog::_cancel_pressed);
ClassDB::bind_method("_tree_node_selected", &ConnectDialog::_tree_node_selected);
ClassDB::bind_method("_tree_item_activated", &ConnectDialog::_tree_item_activated);
ClassDB::bind_method("_add_bind", &ConnectDialog::_add_bind);
ClassDB::bind_method("_remove_bind", &ConnectDialog::_remove_bind);
@ -363,7 +374,7 @@ ConnectDialog::ConnectDialog() {
tree = memnew(SceneTreeEditor(false));
tree->set_connecting_signal(true);
tree->get_scene_tree()->connect("item_activated", this, "_ok");
tree->get_scene_tree()->connect("item_activated", this, "_tree_item_activated");
tree->connect("node_selected", this, "_tree_node_selected");
tree->set_connect_to_script_mode(true);

View file

@ -76,6 +76,7 @@ class ConnectDialog : public ConfirmationDialog {
void ok_pressed();
void _cancel_pressed();
void _tree_node_selected();
void _tree_item_activated();
void _add_bind();
void _remove_bind();
void _advanced_pressed();