mirror of
https://github.com/swaywm/sway.git
synced 2026-02-20 01:40:41 -05:00
Limit recursion depth when trying to find items under dbus menu
This commit is contained in:
parent
0289272bd0
commit
47234b37da
1 changed files with 3 additions and 1 deletions
|
|
@ -267,7 +267,8 @@ static const struct xdg_popup_listener xdg_popup_listener = {
|
|||
|
||||
static struct swaybar_dbusmenu_menu_item *
|
||||
find_item_under_menu(struct swaybar_dbusmenu_menu *menu, int item_id) {
|
||||
if (!menu->items) {
|
||||
static int recursion_depth = 0;
|
||||
if (!menu->items || recursion_depth > 10) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -277,6 +278,7 @@ find_item_under_menu(struct swaybar_dbusmenu_menu *menu, int item_id) {
|
|||
return item;
|
||||
}
|
||||
if (item->submenu && item->submenu->item_id != 0) {
|
||||
recursion_depth++;
|
||||
struct swaybar_dbusmenu_menu_item *found_item =
|
||||
find_item_under_menu(item->submenu, item_id);
|
||||
if (found_item) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue