GNOME Bugzilla – Bug 654394
suspicious use of floating references in GDBusInterfaceSkeleton
Last modified: 2011-07-12 17:46:20 UTC
/** * g_dbus_interface_skeleton_get_properties: * @interface_: A #GDBusInterfaceSkeleton. * * Gets all D-Bus properties for @interface_. * * Returns: A new, floating, #GVariant of type <link linkend="G-VARIANT-TYPE-VARDICT:CAPS">'a{sv}'</link>. Free with g_variant_unref(). * * Since: 2.30 */ This seems quite wrong. Either a strong GVariant reference or no reference at all should be returned. I imagine you probably want strong. I advise calling g_variant_take_ref() on the return value before passing it on and documenting that the returned value is a normal reference. That will allow implementations to return either strong or floating references from their vfunc and the caller to get a consistent experience.
I don't think there's anything wrong here (only gdbus-codegen(1) or similar will implement this and gdbus-codegen(1) gets it right)... but I'm not opposed to changing it if you supply a patch.
I'll fix this once the patch in bug 627974 lands. Thanks for your attention to detail!
commit 8f5e0cd24016cdf852a809dfb7b1356328542201 Author: Ryan Lortie <desrt@desrt.ca> Date: Tue Jul 12 02:56:57 2011 +0200 GDBusInterfaceSkeleton: fix odd use of floating refs The get_properties() function was documented as returning a floating Switch it over to returning a normal reference and patch a couple of uses. https://bugzilla.gnome.org/show_bug.cgi?id=654394