After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 665928 - GtkWindow: Add comment about floating reference
GtkWindow: Add comment about floating reference
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-12-10 22:33 UTC by David Schleef
Modified: 2014-01-25 04:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (1.04 KB, patch)
2011-12-11 20:05 UTC, David Schleef
committed Details | Review

Description David Schleef 2011-12-10 22:33:24 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.
Comment 1 Matthias Clasen 2011-12-11 16:17:43 UTC
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.
Comment 2 David Schleef 2011-12-11 20:05:15 UTC
Created attachment 203219 [details] [review]
patch
Comment 3 David Schleef 2011-12-11 20:05:51 UTC
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.