From f789c1769095ca48384fd92519fad99583eb7b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E9=9D=92=E5=B1=B1?= Date: Tue, 15 Mar 2022 20:07:50 +0800 Subject: Fix text buf does not clear when calling the method set_item_text in PopupMenu --- scene/gui/popup_menu.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 4220066b20..9fc1fb072c 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -1003,8 +1003,12 @@ void PopupMenu::set_item_text(int p_idx, const String &p_text) { p_idx += get_item_count(); } ERR_FAIL_INDEX(p_idx, items.size()); + if (items[p_idx].text == p_text) { + return; + } items.write[p_idx].text = p_text; items.write[p_idx].xl_text = atr(p_text); + items.write[p_idx].dirty = true; _shape_item(p_idx); control->update(); -- cgit v1.2.3