! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Menu with <OnlyUnallocated/> disappears after adding new entries with xdg-des...
Status:
RESOLVED: FIXED

Comments

Description Marek Marczykowski-Górecki 2016-07-15 04:28:40 CEST
Created attachment 6737 
Toplevel menu description.

I have a menu configured with one submenu ("System Tools") in main menu file and others installed with xdg-desktop-menu install some.directory some.desktop.
After starting the session everything is ok, but after adding new entry, that "System Tools" submenu disappears. Removing "<OnlyUnallocated/>" bring it back (but now filled with all the entries, not only unallocated). Adding "<OnlyUnallocated/>" back make the category gone again. Until session restart.

Steps to reporduce:
1. Place attached xfce-applications.menu in /etc/xdg/menus, as a default menu
2. Check if "System Tools" menu is present.
3. Add new entry with xdg-desktop-menu install some.directory app1.desktop app2.desktop (those files exists and are valid desktop directory/entry descriptions).
4. Observe that "System Tools" is gone.

It's on Fedora 23-based system, garcon 0.4.0.
It worked fine on Fedora 20-based system, garcon 0.2.0.
Comment 1 Yegor Timoshenko 2017-12-14 21:51:40 CET
This is still an issue in garcon 0.6.1.
Comment 2 Yegor Timoshenko 2017-12-14 23:00:23 CET
Created attachment 7490 
12700.patch

Here is patch that fixes this issue. Allocation counter was incremented on each config reload and was never decremented back. 

Solved by adding garcon_menu_item_decrement_allocated() to garcon_menu_item_unref(), symmetrical to garcon_menu_item_increment_allocated() in garcon_menu_item_ref().

Please apply on top of garcon master.
Comment 3 Yegor Timoshenko 2017-12-15 02:03:18 CET
Created attachment 7491 
0001-Decrement-allocation-counter-on-item-unref-12700.patch

Previous patch incorrectly handled <Exclude> allocation counter. Desktop Menu Specification says:

> Note that an entry that is included in a menu but excluded again by a later <Exclude> is still considered allocated (for the purposes of <OnlyUnallocated>) even though that entry no longer appears in the menu.

This version of the patch adds a change to increment allocation counter when garcon_menu_item_pool_filter_exclude() succeeds (i.e. when menu item is excluded).
Comment 4 Skunnyk editbugs 2018-10-17 19:00:58 CEST
I can confirm that I reproduce the bug, and your patch fix it.

Bug #12700

Reported by:
Marek Marczykowski-Górecki
Reported on: 2016-07-15
Last modified on: 2018-11-18

People

Assignee:
Skunnyk
CC List:
2 users

Version

Attachments

Toplevel menu description. (1.53 KB, application/octet-stream)
2016-07-15 04:28 CEST , Marek Marczykowski-Górecki
no flags
12700.patch (1.42 KB, patch)
2017-12-14 23:00 CET , Yegor Timoshenko
no flags
0001-Decrement-allocation-counter-on-item-unref-12700.patch (2.06 KB, patch)
2017-12-15 02:03 CET , Yegor Timoshenko
no flags

Additional information