On Mon, 2006-01-02 at 08:55 +0800, James Henstridge wrote: > This sounds a lot more sensible than a new class. If some > non-constructor function gives you a GObject, the distinction between a > GObject and GUnowned doesn't tell you anything -- it only tells you > about initial conditions. > > Also, modelling the state of the initial reference through inheritance > doesn't seem to account for GtkWindow and its subtypes, which derive > from GtkObject (which would be a GUnowned subclass), but don't start > with a single floating reference to begin with.
However, you can't just turn on a "is a normal GObject" flag for
GtkWindow.
window = gtk_window_new();
g_object_unref(window);
Is a bug (and I think even double-unrefs). GtkWindow's are created
owning their own refcount, which they unref on ::destroy. (Alternatively
you can think of the refcount being held by the global list of
windows accessed by gtk_window_list_toplevels())
A GtkWindow should be handled just like any other GtkObject from
a language binding.
window = gtk_window_new ();
g_object_ref (window);
gtk_object_sink (window);
[... use the window, time passes...]
g_object_unref (window);
(Prior to recent changes. Mutatis mutandis.)
Regards,
Owen
signature.asc
Description: This is a digitally signed message part
_______________________________________________ gtk-devel-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtk-devel-list
