1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-02 16:48:55 +00:00

Fix the returned controls of EditorHelpBitTooltip::show_tooltip() were not freed in ScriptTextEditor

The returned control is an orphan node, which is to make the standard tooltip invisible.
This commit is contained in:
风青山
2025-11-23 21:42:48 +08:00
parent 235a32ad11
commit 81f727b6dd
6 changed files with 12 additions and 9 deletions

View File

@@ -4643,7 +4643,7 @@ void EditorHelpBitTooltip::_notification(int p_what) {
} }
} }
Control *EditorHelpBitTooltip::show_tooltip(Control *p_target, const String &p_symbol, const String &p_prologue, bool p_use_class_prefix) { Control *EditorHelpBitTooltip::make_tooltip(Control *p_target, const String &p_symbol, const String &p_prologue, bool p_use_class_prefix) {
ERR_FAIL_NULL_V(p_target, _make_invisible_control()); ERR_FAIL_NULL_V(p_target, _make_invisible_control());
// Show the custom tooltip only if it is not already visible. // Show the custom tooltip only if it is not already visible.

View File

@@ -380,7 +380,8 @@ protected:
void _notification(int p_what); void _notification(int p_what);
public: public:
static Control *show_tooltip(Control *p_target, const String &p_symbol, const String &p_prologue = String(), bool p_use_class_prefix = false); // The returned control is an orphan node, which is to make the standard tooltip invisible.
[[nodiscard]] static Control *make_tooltip(Control *p_target, const String &p_symbol, const String &p_prologue = String(), bool p_use_class_prefix = false);
void popup_under_cursor(); void popup_under_cursor();

View File

@@ -1397,7 +1397,7 @@ Control *EditorProperty::make_custom_tooltip(const String &p_text) const {
} }
if (!symbol.is_empty() || !prologue.is_empty()) { if (!symbol.is_empty() || !prologue.is_empty()) {
return EditorHelpBitTooltip::show_tooltip(const_cast<EditorProperty *>(this), symbol, prologue); return EditorHelpBitTooltip::make_tooltip(const_cast<EditorProperty *>(this), symbol, prologue);
} }
return nullptr; return nullptr;
@@ -1780,7 +1780,7 @@ Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) cons
return nullptr; return nullptr;
} }
return EditorHelpBitTooltip::show_tooltip(const_cast<EditorInspectorCategory *>(this), p_text); return EditorHelpBitTooltip::make_tooltip(const_cast<EditorInspectorCategory *>(this), p_text);
} }
void EditorInspectorCategory::set_as_favorite() { void EditorInspectorCategory::set_as_favorite() {
@@ -2290,7 +2290,7 @@ Control *EditorInspectorSection::make_custom_tooltip(const String &p_text) const
} }
if (!symbol.is_empty() || !prologue.is_empty()) { if (!symbol.is_empty() || !prologue.is_empty()) {
return EditorHelpBitTooltip::show_tooltip(const_cast<EditorInspectorSection *>(this), symbol, prologue); return EditorHelpBitTooltip::make_tooltip(const_cast<EditorInspectorSection *>(this), symbol, prologue);
} }
return nullptr; return nullptr;

View File

@@ -953,7 +953,7 @@ Control *ConnectionsDockTree::make_custom_tooltip(const String &p_text) const {
return nullptr; return nullptr;
} }
return EditorHelpBitTooltip::show_tooltip(const_cast<ConnectionsDockTree *>(this), p_text); return EditorHelpBitTooltip::make_tooltip(const_cast<ConnectionsDockTree *>(this), p_text);
} }
struct _ConnectionsDockMethodInfoSort { struct _ConnectionsDockMethodInfoSort {

View File

@@ -2336,7 +2336,7 @@ ThemeTypeDialog::ThemeTypeDialog() {
/////////////////////// ///////////////////////
Control *ThemeItemLabel::make_custom_tooltip(const String &p_text) const { Control *ThemeItemLabel::make_custom_tooltip(const String &p_text) const {
return EditorHelpBitTooltip::show_tooltip(const_cast<ThemeItemLabel *>(this), p_text); return EditorHelpBitTooltip::make_tooltip(const_cast<ThemeItemLabel *>(this), p_text);
} }
VBoxContainer *ThemeTypeEditor::_create_item_list(Theme::DataType p_data_type) { VBoxContainer *ThemeTypeEditor::_create_item_list(Theme::DataType p_data_type) {

View File

@@ -1422,7 +1422,8 @@ void ScriptTextEditor::_show_symbol_tooltip(const String &p_symbol, int p_row, i
} }
if (p_symbol.begins_with("res://") || p_symbol.begins_with("uid://")) { if (p_symbol.begins_with("res://") || p_symbol.begins_with("uid://")) {
EditorHelpBitTooltip::show_tooltip(code_editor->get_text_editor(), "resource||" + p_symbol); Control *tmp = EditorHelpBitTooltip::make_tooltip(code_editor->get_text_editor(), "resource||" + p_symbol);
memdelete(tmp);
return; return;
} }
@@ -1532,7 +1533,8 @@ void ScriptTextEditor::_show_symbol_tooltip(const String &p_symbol, int p_row, i
} }
if (!doc_symbol.is_empty() || !debug_value.is_empty()) { if (!doc_symbol.is_empty() || !debug_value.is_empty()) {
EditorHelpBitTooltip::show_tooltip(code_editor->get_text_editor(), doc_symbol, debug_value, true); Control *tmp = EditorHelpBitTooltip::make_tooltip(code_editor->get_text_editor(), doc_symbol, debug_value, true);
memdelete(tmp);
} }
} }