Rename-to annotation breaks invoker matching
For instance, let's take the GDBusInterface.dup_object()
virtual method, which is expressed in the GIR:
<virtual-method name="dup_object" invoker="dup_object" version="2.32">
Which matches the vfunc to the g_dbus_interface_dup_object()
method as the invoker for the virtual function.
Sadly, g_dbus_interface_dup_object()
is annotated with rename-to
to shadow the deprecated g_dbus_interface_get_object()
function:
/**
* g_dbus_interface_dup_object: (rename-to g_dbus_interface_get_object)
* @interface_: An exported D-Bus interface.
*
* Gets the #GDBusObject that @interface_ belongs to, if any.
*
* Returns: (nullable) (transfer full): A #GDBusObject or %NULL. The returned
* reference should be freed with g_object_unref().
*
* Since: 2.32
*/
Which produces the following GIR:
<method name="dup_object"
c:identifier="g_dbus_interface_dup_object"
shadows="get_object"
version="2.32">
Internally, the GIR-to-typelib conversion will hide dup_object
and replace it with the name it's shadowing, so the entry for dup_object
in the typelib will be called get_object
.
Due to a bug in how we find the offset of a member in the node, and the fact that dup_object()
is at the end of the GDBusInterface
vtable, this works out by sheer happenstance. Once we fix the bug in libgirepository, to avoid putting invalid indices when a member is not found, we end up with an error.
The simple fix would be to drop the rename-to
from GIO: it's pointless sugar that should not have been added but it's a IABI change, and reverting a change after 9 years, it's bound to break some stuff.
Alternatively, we need to find a way to maintain the old name in the GIrNode
for function types, so we can match them.