Merge pull request #87249 from bruvzg/macos_menu_clear
[macOS] Do not unbind PopupMenu from global menu on `clear` call.
This commit is contained in:
commit
04eafd557f
1 changed files with 3 additions and 2 deletions
|
@ -2424,7 +2424,8 @@ void PopupMenu::clear(bool p_free_submenus) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!global_menu_name.is_empty()) {
|
if (!global_menu_name.is_empty()) {
|
||||||
for (int i = 0; i < items.size(); i++) {
|
DisplayServer *ds = DisplayServer::get_singleton();
|
||||||
|
for (int i = items.size() - 1; i >= 0; i--) {
|
||||||
Item &item = items.write[i];
|
Item &item = items.write[i];
|
||||||
if (!item.submenu.is_empty()) {
|
if (!item.submenu.is_empty()) {
|
||||||
PopupMenu *pm = Object::cast_to<PopupMenu>(get_node_or_null(item.submenu));
|
PopupMenu *pm = Object::cast_to<PopupMenu>(get_node_or_null(item.submenu));
|
||||||
|
@ -2433,8 +2434,8 @@ void PopupMenu::clear(bool p_free_submenus) {
|
||||||
}
|
}
|
||||||
item.submenu_bound = false;
|
item.submenu_bound = false;
|
||||||
}
|
}
|
||||||
|
ds->global_menu_remove_item(global_menu_name, i);
|
||||||
}
|
}
|
||||||
DisplayServer::get_singleton()->global_menu_clear(global_menu_name);
|
|
||||||
}
|
}
|
||||||
items.clear();
|
items.clear();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue