GNOME Bugzilla – Bug 754990
Missing (out) annotation for gdk_rgba_parse
Last modified: 2016-02-02 18:44:52 UTC
For gdk_rbga_parse, we have: /** * gdk_rgba_parse: * @rgba: the #GdkRGBA to fill in * @spec: the string specifying the color * * Parses a textual representation of a color, filling in * the @red, @green, @blue and @alpha fields of the @rgba #GdkRGBA. * * ... */ gboolean gdk_rgba_parse (GdkRGBA *rgba, const gchar *spec) So it looks like the argument rgba should be annotated with (out). I hesitate to say (out) is definitely missing in case this was deliberate to allow an existing structure to be overwritten. Compared with the deprecated gdk_color_parse, the argument order is swapped so Gdk.RGBA.parse appears as a method in the GIR file where as Gdk.Color.parse is a function. Adding the (out) annotation to gdk_rgba_parse causes the method to move to a namespace-level function as follows: <function name="rgba_parse" c:identifier="gdk_rgba_parse" moved-to="RGBA.parse" version="3.0"> <doc xml:space="preserve">...</doc> <return-value transfer-ownership="none"> <doc xml:space="preserve">%TRUE if the parsing succeeded</doc> <type name="gboolean" c:type="gboolean"/> </return-value> <parameters> <parameter name="rgba" direction="out" caller-allocates="1" transfer-ownership="none"> <doc xml:space="preserve">the #GdkRGBA to fill in</doc> <type name="RGBA" c:type="GdkRGBA*"/> </parameter> <parameter name="spec" transfer-ownership="none"> <doc xml:space="preserve">the string specifying the color</doc> <type name="utf8" c:type="const gchar*"/> </parameter> </parameters> </function> That could cause an issue if the attribute moved-to="RGBA.parse" isn't respected.
Created attachment 311268 [details] [review] Add missing (out) annotation to gdk_rgba_parse Here's the patch in case it's wanted
Attachment 311268 [details] pushed as 6958609 - Add missing (out) annotation to gdk_rgba_parse
To make sure this is a deliberate decision: This is an introspection API break, and an equivalent change was proposed in bug 682125 but rejected to maintain stability.
I'm not aware of any language binding that will honour the moved-to flag, since it's not really handled specially in the girepository API. Personally, I think this change should be reverted, as it will break existing code. Gdk.RGBA.parse() is meant to be used as a method, not as a constructor.
revert it for all I care. please file annotation bugs in the language bindings component going forward, I won't touch that
Reverted it in master, and marked as a duplicate of bug 682125. *** This bug has been marked as a duplicate of bug 682125 ***
Thanks for the quick reaction. Just for the record: the moved-to flag is a red herring in this case. With the change that was just backed out, there would still be a Gdk.RGBA.parse -- it would just not be a method anymore. In addition, a Gdk.rgba_parse would be added for backwards compatibility with very old gobject-introspection behaviour -- and only this back-compat copy would have the moved-to flag.