mirror of
https://github.com/swaywm/sway.git
synced 2026-04-09 08:21:26 -04: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 *
|
static struct swaybar_dbusmenu_menu_item *
|
||||||
find_item_under_menu(struct swaybar_dbusmenu_menu *menu, int item_id) {
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -277,6 +278,7 @@ find_item_under_menu(struct swaybar_dbusmenu_menu *menu, int item_id) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
if (item->submenu && item->submenu->item_id != 0) {
|
if (item->submenu && item->submenu->item_id != 0) {
|
||||||
|
recursion_depth++;
|
||||||
struct swaybar_dbusmenu_menu_item *found_item =
|
struct swaybar_dbusmenu_menu_item *found_item =
|
||||||
find_item_under_menu(item->submenu, item_id);
|
find_item_under_menu(item->submenu, item_id);
|
||||||
if (found_item) {
|
if (found_item) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue