GNOME Bugzilla – Bug 721588
gobject-introspection misses a third parameter for g_application_register
Last modified: 2015-02-07 16:57:58 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>
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
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.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]