RE: qdata callback not called

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

 



On Thu, 2003-06-26 at 12:06, Murray.Cumming@Comneon.com wrote:

> > The reason that it leaks is probably most apparent if you 
> > understand why it is *not* leaked in the normal case:
> > 
> >  create button: reference count 1, floating
> >  add button to container: container adopts button, reference count 1,
> >   not floating
> >  destroy button: button is removed from parent, reference
> >   count drops to 0, finalized
> > 
> > But if you destroy a floating button, nothing will happen to
> > the reference count.
> 
> OK, thanks. Out of interest, can we explicitly finalize the button, or do we
> have to add it to a container, then destroy it, in order to avoid the leak.

Generally, if you have your own ways of handling memory management, you
should immediately adopt reference counts to widgets when they are
created by calling g_object_ref (widget); gtk_object_sink (widget); ...
from that point on, reference counting will work in a straightfoward
fashion.

In general, an object should *never* be unref'ed while it has
a floating reference count so g_object_unref (button); would be
incorrect.

Regards,
						Owen




[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux