mirror of
https://github.com/labwc/labwc.git
synced 2026-04-19 06:46:31 -04:00
menu: prevent memory leak when cycling through menu items
This commit is contained in:
parent
eba57831f4
commit
667707c029
1 changed files with 5 additions and 1 deletions
|
|
@ -1475,7 +1475,7 @@ bool
|
|||
menu_item_select_by_accelerator(char accelerator)
|
||||
{
|
||||
struct menu *menu = get_selection_leaf();
|
||||
if (!menu) {
|
||||
if (!menu || wl_list_empty(&menu->menuitems)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1489,6 +1489,10 @@ menu_item_select_by_accelerator(char accelerator)
|
|||
struct menuitem *next_selection = NULL;
|
||||
do {
|
||||
current = current->next;
|
||||
if (current == &menu->menuitems) {
|
||||
/* Allow wrap around */
|
||||
continue;
|
||||
}
|
||||
item = wl_container_of(current, item, link);
|
||||
if (item->accelerator == accelerator) {
|
||||
if (!matched) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue