Re: ABI and API for g_object_ref_sink() (Re: GTK_FLOATI




On Dec 15, 2005, at 8:13 PM, Tim Janik wrote:

On Thu, 15 Dec 2005, muppet wrote:

From a language binding it's not very easy to hook into GObject destruction without subclassing, but GtkObject's destroy makes this easy.

there is no such thing as a GObject destruction. a GObject can just be
disposed (means: break any references it may hold to other objects), and
that multiple times, and at some point it will be finalized.
a language binding already can hook up weak references to do stuff upon dispose, and other kind of user data it sets up will be removed with finalize. additionally 2.8 introduced toggle references specifically for language bindings, so there's really nothing left from a binding perspective to hook
into a GObjects lifetime.

From the point of view of developing a language binding, yes, that all works and is quite nice. I was speaking from the point of view of *using* a language binding. GtkWidget::destroy is emitted in gtk_object_dispose. GObject's dispose does not emit a signal, so there's no way to hook into disposal without subclassing.

I can create my own subclass that adds the emission of such a signal in my app... and then we're back to the argument for putting floating references down in GObject --- you don't have to use it, but people who want it don't have to reimplement it.

(I'm certain that this idea has already been thoroughly discussed -- do you happen to have a link to a thread or bug that explains it?)


--
"Ears! They help us -- Ears! They help us hear th-- Ea--E--E--E-- Ears!"
  -- A Sesame Street singing toy, with Yvonne gleefully pressing
    the button over and over and over and over and...




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