vapigen detects wrong parameter type for GValue **
Submitted by Mardy
Link to original bug (#666549)
Description
Created attachment 203897 libaccounts-glib GObject introspection data
Hi, when running vapigen with the attached Accounts-1.0.gir file, the last parameter for the AccountSettingIter::next() method is wrong. This is what gets generated:
============= public class AccountSettingIter { public weak Ag.Account account; public void free (); public bool next (out unowned string key, out GLib.Value value); }
However, the .gir file describes the "value" parameter like this:
</doc>
</parameter>
=============
a pointer to a pointer to a #GValue, to receive the key value.Note the double "*" on the GValue. In fact, the C API is:
gboolean ag_account_settings_iter_next (AgAccountSettingIter *iter, const gchar **key, const GValue **value);
The problem is that with the automatically generated .vapi file, the following code:
============= unowned string key; Value value;
while (iter.next(out key, out value))
generates the wrong C code: a GValue is allocated on the stack, and a pointer to it is passed to ag_account_settings_iter_next(). When accessing the "value" variable later on, the application crashes.
Attachment 203897, "libaccounts-glib GObject introspection data":
Accounts-1.0.gir