diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-01-16 12:32:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-16 12:32:52 +0100 |
commit | fc2550c4c8e9ca4ee7378af0330544695d04d6c8 (patch) | |
tree | f8c280657fdb70b44c809d3a0a1b1e25533687a9 | |
parent | 613503755103b6195488992f922dffedf2258a2a (diff) | |
parent | 71b4b180bae83f47ad32dacfc64818d80ba91f2b (diff) |
Merge pull request #35123 from asynts/asynts.crash-on-double-click
Prevent crash described in #34555.
-rw-r--r-- | editor/connections_dialog.cpp | 13 | ||||
-rw-r--r-- | editor/connections_dialog.h | 1 |
2 files changed, 13 insertions, 1 deletions
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index ec40b3254f..2ef5097345 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -150,6 +150,16 @@ void ConnectDialog::_tree_node_selected() { } /* + * 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. */ void ConnectDialog::_add_bind() { @@ -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); diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h index 8ef4eddea1..4f46e145e1 100644 --- a/editor/connections_dialog.h +++ b/editor/connections_dialog.h @@ -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(); |