Repository: godotengine/godot
File: editor/scene/connections_dialog.cpp (C++)

Code before:

			tree->add_theme_constant_override("icon_max_width", get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)));

			update_tree();
		} break;

		case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
			if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editors")) {
				update_tree();
			}
		} break;
	}
}

void ConnectionsDock::_bind_methods() {
	ClassDB::bind_method("update_tree", &ConnectionsDock::update_tree);
}

void ConnectionsDock::set_object(Object *p_obj) {
	selected_object = p_obj;
	if (selected_object) {
		if (selected_object->is_class("Resource")) {
			is_editing_resource = true;
		} else {
			is_editing_resource = false;
		}
	}
	update_tree();
}

void ConnectionsDock::update_tree() {
	String prev_selected;
	if (tree->is_anything_selected()) {
		prev_selected = tree->get_selected()->get_text(0);
	}
	tree->clear();

	if (!selected_object) {
		return;
	}

	TreeItem *root = tree->create_item();
	DocTools *doc_data = EditorHelp::get_doc_data();
	EditorData &editor_data = EditorNode::get_editor_data();
	StringName native_base = selected_object->get_class();
	Ref<Script> script_base = selected_object->get_script();

	while (native_base != StringName()) {
		String class_name;
		String doc_class_name;
		Ref<Texture2D> class_icon;

Review comment (bug):
```suggestion
		is_editing_resource  = (Object::cast_to<Resource>(selected_object) != nullptr)
```

Code after:
			signal_menu->set_item_icon(signal_menu->get_item_index(SIGNAL_MENU_CONNECT), get_editor_theme_icon(SNAME("Instance")));
			signal_menu->set_item_icon(signal_menu->get_item_index(SIGNAL_MENU_DISCONNECT_ALL), get_editor_theme_icon(SNAME("Unlinked")));
			signal_menu->set_item_icon(signal_menu->get_item_index(SIGNAL_MENU_COPY_NAME), get_editor_theme_icon(SNAME("ActionCopy")));
			signal_menu->set_item_icon(signal_menu->get_item_index(SIGNAL_MENU_OPEN_DOCS), get_editor_theme_icon(SNAME("Help")));

			slot_menu->set_item_icon(slot_menu->get_item_index(SLOT_MENU_EDIT), get_editor_theme_icon(SNAME("Edit")));
			slot_menu->set_item_icon(slot_menu->get_item_index(SLOT_MENU_GO_TO_METHOD), get_editor_theme_icon(SNAME("ArrowRight")));
			slot_menu->set_item_icon(slot_menu->get_item_index(SLOT_MENU_DISCONNECT), get_editor_theme_icon(SNAME("Unlinked")));

			tree->add_theme_constant_override("icon_max_width", get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)));

			update_tree();
		} break;

		case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
			if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editors")) {
				update_tree();
			}
		} break;
	}
}

void ConnectionsDock::_bind_methods() {
	ClassDB::bind_method("update_tree", &ConnectionsDock::update_tree);
}

void ConnectionsDock::set_object(Object *p_obj) {
	selected_object = p_obj;
	is_editing_resource = (Object::cast_to<Resource>(selected_object) != nullptr);
	update_tree();
}

void ConnectionsDock::update_tree() {
	String prev_selected;
	if (tree->is_anything_selected()) {
		prev_selected = tree->get_selected()->get_text(0);
	}
	tree->clear();

	if (!selected_object) {
		return;
	}

	TreeItem *root = tree->create_item();
	DocTools *doc_data = EditorHelp::get_doc_data();
	EditorData &editor_data = EditorNode::get_editor_data();
	StringName native_base = selected_object->get_class();
	Ref<Script> script_base = selected_object->get_script();

	while (native_base != StringName()) {
		String class_name;