Recreated indicator has old menu
An indicator, which is recreated with the same ID as before its deletion, has the old (unusable) menu. The menu from dbusmenu is probably somehow cached but becomes stale.
Proof of concept script
Consider the following proof of concept script: indicator-recreate.py, which does the following:
- Creates an indicator titled
indicator1
and menu item labelleditem1
. - Deletes the indicator.
- Recreates the indicator titled
indicator2
and menu item labelleditem2
.
Actual result
There is an indicator with the title indicator2
but it has a menu item labelled item1
.
Expected result
There is an indicator with the title indicator2
and it has a menu item labelled item2
.
Notes
After doing xfce4-panel -r
indicator2
shows up correctly with item2
in its menu, so the correct menu seems to be present on dbus.
Under Gnome (Ubuntu 20.04) the script works as expected. Under KDE (Kubuntu 20.04) it seems to cause some dbus connection error when recreating the indicator, not sure what that's about.
Since becoming aware of this issue, I've realized that I might've seen this happen before with kdeconnect-indicator, which also gets recreated as the mobile device disconnects and reconnects, but its menu has seemed to not work properly at some point.