Re: Reference counting advice needed



On Wed, 6 Jun 2001, Jeff Franks wrote:

> Hi,
>
> I need some advice on reference counting. Is it right that when your
> using objects which derive from GObject, unlike GtkObject, its safe to
> use the object returned from gtk_x_new without calling gtk_x_ref. Only
> calling gtk_x_unref when your finished, e.g.  GtkStyle.

Generally, GObjects do not have a floating reference.  The object you get
from the ..._new() function has reference count 1, so you will need to
unref it to destroy it.  GtkObject introduces a floating reference idea,
as do a few other GObject subclasses.

James.





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