Indicator objects are not being disposed (and the dispose method is broken)

Bug #355831 reported by Eitan Isaacson
2
Affects Status Importance Assigned to Milestone
Indicator Applet
Fix Released
High
Ted Gould

Bug Description

When an indicator object is instantiated, it has a reference count of 2. This is because it is incremented once in the gobject init function, and once in indicate_server_add_indicator which the init function calls.

The indicators in the Pidgin plugin are not being disposed of for this reason, since only one unref is called in the IM focus callback.

If a programmer hackishly brought the ref count to zero (by unreffing twice), the indicator would run into an unref in the dispose function, because it calls indicate_server_remove_indicator which does an unref (on an object with 0 ref count).

My proposal would be to remove the ref/unref from the server add/hide functions. Their GTK+ equivalents do ref/unref, but in our case the server is singleton, and the adding/removing is done implicitly anyway.

This also raises a semi-related API question: Should the add/remove be in the public API? It seems to me that since the server is singleton there is no need for this. All that is probably needed is a destroy() of some sorts for explicit removal. But hide() and a proper GC would do too.

Related branches

Revision history for this message
Eitan Isaacson (eeejay) wrote :
Changed in indicator-applet:
assignee: nobody → ted-gould
Ted Gould (ted)
Changed in indicator-applet:
importance: Undecided → High
milestone: none → 0.1.5
status: New → Confirmed
Revision history for this message
Ted Gould (ted) wrote :

I committed the patch. I want to leave the functions in the API just for people who are perhaps building their own indicator subclasses. There's really no way to do 'friends' in GObject that way. Thanks for the patch! Good catch!

Changed in indicator-applet:
status: Confirmed → Fix Committed
Ted Gould (ted)
Changed in indicator-applet:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.