Comment 104 for bug 569273

Revision history for this message
Michael Terry (mterry) wrote :

I have looked into this and have a fix and an explanation. First, please be mindful of this bugs many subscribers before following up with non-technical comments.

The bug appears to be in libappindicator itself. The call to app_indicator_set_menu leaks the old menu every time a new menu is passed in. It should instead sink any floating ref on the old menu than just unconditionally adding a new reference (see [1] for technical details on what the heck that means).

There's actually two possible ways to fix this. (A) change libappindicator to sink the ref, which would arguably be an API change. Or (B) change gnome-power-manager to manually unref the menu after passing it to libappindicator. I'm going with (A) for now and have filed a patch against libappindicator [2].

I suspect that even if method (A) is approved and merged for natty, method (B) is most appropriate for any possible SRUs.

[1] http://library.gnome.org/devel/gobject/stable/gobject-The-Base-Object-Type.html#floating-ref
[2] https://code.launchpad.net/~mterry/libappindicator/fix-menu-leak/+merge/53247