mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05: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
3a7c6ce300
commit
d7e6f3a7a8
1 changed files with 11 additions and 0 deletions
|
|
@ -663,6 +663,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