BonoboControl refcounting



Hello,

    I was trying to figure why galeon was leaking widgets in its toolbar
code, and I think that I've found a problem with the way BonoboControl
refcounting is done:

In bonobo_control_init, create plug is called. This function creates a
BonoboPlug and calls bonobo_control_set_plug (which increases the plug
refcount in 1) and then unrefs the plug. After this, the plug refcount
is 1.

The problems comes when bonobo_control_set_plug calls
bonobo_plug_set_control, which in turns increases the control's
refcount. So, after all this the control refcount is 2 and the plug's
refcount is 1 and we have a circular reference. This means that the
control is never going to be finalized.

Just after bonobo_control_new (widget), the returned object has a
refcount of 3. I don't know where the extra ref is coming from...

When creating a new control with bonobo_control_new (widget),
bonobo_control_construct (control, widget) is called. This increases the
refcount of the object and sinks it. Then it adds it to to the plug.
This means that the widget refcount is increased in 1. And it will be
never finalized.

Does all this makes any sense? Am I just wrong? ;)

If I'm wrong, how am I supposed to manage the life cycle of bonobo
controls?

-- 
Ricardo Fernández Pascual
ric users sourceforge net
Murcia. España.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]