GNOME Bugzilla – Bug 665928
GtkWindow: Add comment about floating reference
Last modified: 2014-01-25 04:53:28 UTC
I was somewhat surprised to see that gtk_window_new() does not return a floating reference, even though it is a subclass of GInitiallyUnowned. Added a note in the documentation. There may be more of these, if someone knows of a list, I'll update the patch.
While we may want to explain the fact that gtk owns a reference to a GdkWindow that it drops when you call gtk_widget_destroy() on it, I wonder what practical difference it makes to you. The fact that GtkWindow is a GInitiallyUnowned tells you that if you want to take a reference on it, you ought to call g_object_ref_sink(). That will give you a reference, regardless whether the object was floating or not.
Created attachment 203219 [details] [review] patch
Yeah, I picked up on that soon after I realized that that real reference was not *my* reference. All stuff I've known at some point or another, but had forgotten. New patch.