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 721588 - gobject-introspection misses a third parameter for g_application_register
gobject-introspection misses a third parameter for g_application_register
Status: RESOLVED NOTABUG
Product: gobject-introspection
Classification: Platform
Component: general
1.36.x
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-01-05 17:45 UTC by Andrew Haines
Modified: 2015-02-07 16:57 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Andrew Haines 2014-01-05 17:45:44 UTC
I create the freepascal bindings to Glib Gtk etc and we stumbled across an error in our bindings which turned out to be a missing 3rd parameter in the g_application_register definition in the xml gir file.

The definition is 
gboolean g_application_register (GApplication *application, GCancellable *cancellable, GError **error);

and the following is an excerpt from the Gio-2.0.gir file which is missing the last param. I am using gobject-introspection 1.36.0-r1 from the gentoo packages.

<method name="register"
              c:identifier="g_application_register"
              version="2.28"
              throws="1">
        <return-value transfer-ownership="none">
          <doc xml:whitespace="preserve">%TRUE if registration succeeded</doc>
          <type name="gboolean" c:type="gboolean"/>
        </return-value>
        <parameters>
          <instance-parameter name="application" transfer-ownership="none">
            <doc xml:whitespace="preserve">a #GApplication</doc>
            <type name="Application" c:type="GApplication*"/>
          </instance-parameter>
          <parameter name="cancellable"
                     transfer-ownership="none"
                     allow-none="1">
            <doc xml:whitespace="preserve">a #GCancellable, or %NULL</doc>
            <type name="Cancellable" c:type="GCancellable*"/>
          </parameter>
        </parameters>
</method>
Comment 1 Simon Feltman 2014-01-05 18:07:58 UTC
It can be a little hard to discover, but I'm pretty sure any function which has throws="1" can be assumed to have a tail end GError**. Essentially a C version of an exception. (There are many functions that will have a similar layout).

Any function with throws=1 you can pass the address of a GError pointer. If after the call the pointer is non NULL, you can translate from the GError into a native error and then free the GError (in Python we translate this in an exception that is raised to the caller).

See also:
https://developer.gnome.org/gi/stable/gi-GIFunctionInfo.html#GIFunctionInfoFlags
https://developer.gnome.org/glib/2.37/glib-Error-Reporting.html
Comment 2 Andrew Haines 2014-01-05 18:36:03 UTC
Ok thanks this is a good hint. I will update the converter and check the differences to see if there are other functions in our bindings that are incorrect.
Comment 3 André Klapper 2015-02-07 16:57:58 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]