Re: gtk_object_sink in glade_palette_init



On Tue, Nov 28, 2006 at 07:32:14AM +0100, Philippe Bertin wrote:

In glade_palette_init, there's this piece of code :

    /* Add items tray (via a scrolled window) */
    priv->tray = gtk_vbox_new (FALSE, 0);
    g_object_ref (G_OBJECT (priv->tray));
    gtk_object_sink (GTK_OBJECT (priv->tray));

What's the goal of this gtk_object_sink?

I haven't read the code, but probably the vbox can be
temporarily removed from its container and should not cease
to exist when this happens so a reference is taken on it.

I thought that after 
glade_palette_init returns, the local references are gone?

What local references?  When you reference an object you own
a reference until you explicitly release it or until the end
of the program, whichever comes first.

P.S. Looking for the meaning of the gtk_object_sink call, at 
http://developer.gnome.org/doc/API/2.0/gtk/GtkObject.html#gtk-object-sink 
I see it's deprecated. g_object_ref_sink should be called instead 

In newly written code.  Is this newly written code?

Using g_object_ref_sink() instead of gtk_object_sink() makes
your program require GLib 2.10+ without any practical
benefit.  If your program already requires GLib 2.10+
because you make use of its features then of course use
g_object_ref_sink().

Yeti


--
Whatever.



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