g_arg_info_get_closure does not always return -1 on non-callback parameters
According to its docblock, g_arg_info_get_closure
is only valid for arguments which are callbacks. Not sure what that does mean, but I expected -1
for anything that is not a callback.
This is not true, see the following code:
/*
* gcc test.c $(pkg-config --cflags --libs gobject-introspection-1.0) -o test
*
* And this is what I get:
* g_file_copy_async, parameter 'user_data', g_arg_info_get_closure returns 6
*/
#include <girepository.h>
int main()
{
GIBaseInfo *file;
GIFunctionInfo *copy_async;
GIArgInfo *user_data;
g_irepository_require(NULL, "Gio", NULL, 0, NULL);
file = g_irepository_find_by_name(NULL, "Gio", "File");
g_assert(file != NULL);
copy_async = g_interface_info_find_method((GIInterfaceInfo *) file, "copy_async");
g_assert(copy_async != NULL);
user_data = g_callable_info_get_arg((GICallableInfo *) copy_async, 7);
g_assert(user_data != NULL);
g_print("g_file_copy_async, parameter '%s', g_arg_info_get_closure returns %d\n",
g_base_info_get_name((GIBaseInfo *) user_data),
g_arg_info_get_closure(user_data));
g_base_info_unref(file);
return 0;
}