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 754990 - Missing (out) annotation for gdk_rgba_parse
Missing (out) annotation for gdk_rgba_parse
Status: RESOLVED DUPLICATE of bug 682125
Product: gtk+
Classification: Platform
Component: Language Bindings
3.17.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-09-14 10:56 UTC by Phil Clayton
Modified: 2016-02-02 18:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add missing (out) annotation to gdk_rgba_parse (742 bytes, patch)
2015-09-14 11:01 UTC, Phil Clayton
committed Details | Review

Description Phil Clayton 2015-09-14 10:56:07 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.
Comment 1 Phil Clayton 2015-09-14 11:01:31 UTC
Created attachment 311268 [details] [review]
Add missing (out) annotation to gdk_rgba_parse

Here's the patch in case it's wanted
Comment 2 Matthias Clasen 2016-01-23 23:18:26 UTC
Attachment 311268 [details] pushed as 6958609 - Add missing (out) annotation to gdk_rgba_parse
Comment 3 Torsten Schoenfeld 2016-02-02 13:19:51 UTC
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.
Comment 4 Emmanuele Bassi (:ebassi) 2016-02-02 14:42:14 UTC
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.
Comment 5 Matthias Clasen 2016-02-02 14:45:12 UTC
revert it for all I care. please file annotation bugs in the language bindings component going forward, I won't touch that
Comment 6 Emmanuele Bassi (:ebassi) 2016-02-02 15:11:56 UTC
Reverted it in master, and marked as a duplicate of bug 682125.

*** This bug has been marked as a duplicate of bug 682125 ***
Comment 7 Torsten Schoenfeld 2016-02-02 18:44:52 UTC
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.