Skip to content

Commit

Permalink
CraterCrashGH-455 Don't use nothing_selected to avoid crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Jun 29, 2024
1 parent 17fcc90 commit 0d8efeb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/editor/graph/actions/action_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ void OrchestratorGraphActionMenu::_notification(int p_what)
_tree_view->set_select_mode(Tree::SELECT_ROW);
_tree_view->connect("item_activated", callable_mp(this, &OrchestratorGraphActionMenu::_on_tree_item_activated));
_tree_view->connect("item_selected", callable_mp(this, &OrchestratorGraphActionMenu::_on_tree_item_selected));
_tree_view->connect("nothing_selected", callable_mp(this, &OrchestratorGraphActionMenu::_on_tree_item_activated));
_tree_view->connect("button_clicked", callable_mp(this, &OrchestratorGraphActionMenu::_on_tree_button_clicked));
vbox->add_child(_tree_view);

Expand Down Expand Up @@ -244,24 +243,28 @@ TreeItem* OrchestratorGraphActionMenu::_make_item(TreeItem* p_parent,
const Ref<OrchestratorGraphActionMenuItem>& p_menu_item,
const String& p_text)
{
const bool has_handler = p_menu_item->get_handler().is_valid();

TreeItem* child = p_parent->create_child();
child->set_text(0, p_text);
child->set_icon(0, SceneUtils::get_editor_icon(p_menu_item->get_spec().icon));
child->set_tooltip_text(0, p_menu_item->get_spec().tooltip);
child->set_selectable(0, p_menu_item->get_handler().is_valid());
child->set_selectable(0, has_handler);

child->set_text_alignment(1, HORIZONTAL_ALIGNMENT_RIGHT);
child->set_text(1, p_menu_item->get_spec().qualifiers);
child->set_expand_right(1, true);
child->set_selectable(1, has_handler);

child->set_icon(2, SceneUtils::get_editor_icon(p_menu_item->get_spec().type_icon));
child->set_expand_right(2, true);
child->set_text_alignment(2, HORIZONTAL_ALIGNMENT_RIGHT);
child->set_tooltip_text(2, p_menu_item->get_handler().is_valid() ? p_menu_item->get_handler()->get_class() : "");
child->set_tooltip_text(2, has_handler ? p_menu_item->get_handler()->get_class() : "");
child->set_selectable(2, has_handler);

child->set_meta("item", p_menu_item);

if (p_menu_item->get_handler().is_valid())
if (has_handler)
child->set_meta("handler", p_menu_item->get_handler());

return child;
Expand Down

0 comments on commit 0d8efeb

Please sign in to comment.