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.
This is still an issue in garcon 0.6.1.
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.
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).
I can confirm that I reproduce the bug, and your patch fix it.
Fixed in https://git.xfce.org/xfce/garcon/commit/?id=5df804aedbb44c42d050e3865f1af9eac77b89a2 Thank you !