diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-02 22:36:18 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-02 22:36:18 +0100 |
commit | cc27a11a8c2d8275db193ba7512885042ee023dc (patch) | |
tree | e5d8df9871dc78ca0b92ff5b4f254592f872de4a /editor | |
parent | d4bf7f44583b977e9d13a4b7ad25faa529da2eca (diff) | |
parent | ee53b172774d023d77daa7871a2d88bcbd5a44c6 (diff) |
Merge pull request #68177 from KoBeWi/routine_regression
Fix crash in connection dialog
Diffstat (limited to 'editor')
-rw-r--r-- | editor/connections_dialog.cpp | 7 | ||||
-rw-r--r-- | editor/connections_dialog.h | 3 |
2 files changed, 3 insertions, 7 deletions
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index de7f5c8b88..ed2044c117 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -684,6 +684,7 @@ void ConnectionsDock::_connect(ConnectDialog::ConnectionData p_cd) { } Callable callable = p_cd.get_callable(); + Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo(); undo_redo->create_action(vformat(TTR("Connect '%s' to '%s'"), String(p_cd.signal), String(p_cd.method))); undo_redo->add_do_method(source, "connect", p_cd.signal, callable, p_cd.flags); undo_redo->add_undo_method(source, "disconnect", p_cd.signal, callable); @@ -704,6 +705,7 @@ void ConnectionsDock::_disconnect(TreeItem &p_item) { ERR_FAIL_COND(cd.source != selected_node); // Shouldn't happen but... Bugcheck. + Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo(); undo_redo->create_action(vformat(TTR("Disconnect '%s' from '%s'"), cd.signal, cd.method)); Callable callable = cd.get_callable(); @@ -730,6 +732,7 @@ void ConnectionsDock::_disconnect_all() { TreeItem *child = item->get_first_child(); String signal_name = item->get_metadata(0).operator Dictionary()["name"]; + Ref<EditorUndoRedoManager> &undo_redo = EditorNode::get_undo_redo(); undo_redo->create_action(vformat(TTR("Disconnect all from signal: '%s'"), signal_name)); while (child) { @@ -991,10 +994,6 @@ void ConnectionsDock::_bind_methods() { ClassDB::bind_method("update_tree", &ConnectionsDock::update_tree); } -void ConnectionsDock::set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo) { - undo_redo = p_undo_redo; -} - void ConnectionsDock::set_node(Node *p_node) { selected_node = p_node; update_tree(); diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h index 126a0ca828..fcfc501386 100644 --- a/editor/connections_dialog.h +++ b/editor/connections_dialog.h @@ -47,7 +47,6 @@ #include "scene/gui/tree.h" class ConnectDialogBinds; -class EditorUndoRedoManager; class ConnectDialog : public ConfirmationDialog { GDCLASS(ConnectDialog, ConfirmationDialog); @@ -197,7 +196,6 @@ class ConnectionsDock : public VBoxContainer { Button *connect_button = nullptr; PopupMenu *signal_menu = nullptr; PopupMenu *slot_menu = nullptr; - Ref<EditorUndoRedoManager> undo_redo; LineEdit *search_box = nullptr; HashMap<StringName, HashMap<StringName, String>> descr_cache; @@ -231,7 +229,6 @@ protected: static void _bind_methods(); public: - void set_undo_redo(Ref<EditorUndoRedoManager> p_undo_redo); void set_node(Node *p_node); void update_tree(); |