Re: GObject and reference counting?



Darren Kenny <Darren Kenny ireland sun com> writes:
> 
> GtkObject has the concept of a floating object, that could be 'new'ed and then
> the initial reference count 'sink'-ed using gtk_object_sink... does any one
> know if there is any intention to introduce this concept into GObject - it
> would certainly be useful in the managing of memory.
> 

Not currently planned - the rationale is that the "floating" concept
only makes sense for objects that are definitely going to have a
"long-term owner." For example, a widget will be placed in a
container. The oddness that results otherwise is that you leak objects
that don't ever get passed to an owner that sinks them.

The other problem is that a bunch of things that are GObject-derived
now used to be plain refcounted, so stuff would break if they started
floating. (This could be worked around with a ref/sink in the
constructor, but a rule more complicated than "widgets have floating
state, other objects don't" could be hard for people to follow.)

Havoc






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