mirror of
https://github.com/labwc/labwc.git
synced 2026-06-16 14:33:56 -04:00
menu: invalidate nested duplicated menus
Prior to this commit, nesting the same menus caused stack overflow at `close_all_submenus()` when trying to open it.
This commit is contained in:
parent
13a58c58eb
commit
44add666df
1 changed files with 11 additions and 0 deletions
|
|
@ -656,6 +656,17 @@ handle_menu_element(xmlNode *n, struct server *server)
|
|||
}
|
||||
|
||||
struct menu *menu = menu_get_by_id(server, id);
|
||||
|
||||
struct menu *iter = current_menu;
|
||||
while (iter) {
|
||||
if (iter == menu) {
|
||||
wlr_log(WLR_ERROR, "menus with the same id '%s' "
|
||||
"cannot be nested", id);
|
||||
goto error;
|
||||
}
|
||||
iter = iter->parent;
|
||||
}
|
||||
|
||||
if (menu) {
|
||||
current_item = item_create(current_menu, menu->label, true);
|
||||
if (current_item) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue