Public bug reported:

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.

** Affects: indicator-applet
     Importance: Undecided
     Assignee: Ted Gould (ted-gould)
         Status: New

-- 
Indicator objects are not being disposed (and the dispose method is broken)
https://bugs.launchpad.net/bugs/355831
You received this bug notification because you are a member of Indicator
Applet Developers, which is the registrant for Indicator Applet.

Status in Indicator Applet: New

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.

_______________________________________________
Mailing list: https://launchpad.net/~dx-team
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dx-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to