[libglib-perl] 05/11: Add code comments about the peculiar Glib::InitiallyUnowned sink handling

Intrigeri intrigeri at moszumanska.debian.org
Thu Mar 19 13:29:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch experimental
in repository libglib-perl.

commit ef3566b76fa5a4846b9d89c2f70671eeb8b218bb
Author: Torsten Schönfeld <kaffeetisch at gmx.de>
Date:   Sat Nov 29 17:59:16 2014 +0100

    Add code comments about the peculiar Glib::InitiallyUnowned sink handling
---
 GObject.xs | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/GObject.xs b/GObject.xs
index 6aa5b27..94888af 100644
--- a/GObject.xs
+++ b/GObject.xs
@@ -574,6 +574,23 @@ gperl_object_take_ownership (GObject * object)
 static void
 sink_initially_unowned (GObject *object)
 {
+	/* FIXME: This is not correct when the object is not floating.  The
+	 * sink function is supposed to effectively remove a reference, but
+	 * when the object is not floating, ref_sink+unref == ref+unref == nop.
+	 * Luckily, there do not seem to be functions of GInitiallyUnowned
+	 * descendants out there that transfer ownership of a non-floating
+	 * reference to the caller.  If we ever encounter one, this needs to be
+	 * revisited.
+	 *
+	 * One peculiar corner case is Glib::Object::Introspection's handling
+	 * of GtkWindow and its descendants.  G:O:I marks all constructors of
+	 * GInitiallyUnowned descendants as transferring ownership (to override
+	 * special-casing done by gobject-introspection).  This is thus
+	 * inadvertedly also applied to GtkWindow and its descendants even
+	 * though their constructors do not transfer ownership (because gtk+
+	 * keeps an internal reference to each window).  But due to this
+	 * incorrect code below, the ownership transfer is effectively ignored,
+	 * resulting in correct behavior. */
 	g_object_ref_sink (object);
 	g_object_unref (object);
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libglib-perl.git



More information about the Pkg-perl-cvs-commits mailing list