Commit 80f1833e authored by Torsten Schönfeld's avatar Torsten Schönfeld

Use custom code to find struct methods in order to avoid a bug

g_struct_info_find_method is broken for class structs like
GtkWidgetClass, hence reimplement it with get_n_methods and get_method,
which seem to work correctly.
parent a31d977f
/* -*- mode: c; indent-tabs-mode: t; c-basic-offset: 8; -*- */
static GIFunctionInfo *
_find_struct_method (GIStructInfo *info, const gchar *method)
{
/* g_struct_info_find_method is broken for class structs like
* GtkWidgetClass, so we search manually. See
* <https://bugzilla.gnome.org/show_bug.cgi?id=700338>. */
gint n_methods;
gint i;
n_methods = g_struct_info_get_n_methods (info);
for (i = 0; i < n_methods; i++) {
GIFunctionInfo *method_info =
g_struct_info_get_method (info, i);
if (strEQ (g_base_info_get_name (method_info), method))
return method_info;
g_base_info_unref (method_info);
}
return NULL;
}
static GIFunctionInfo *
_find_enum_method (GIEnumInfo *info, const gchar *method)
{
......@@ -48,7 +67,7 @@ get_function_info (GIRepository *repository,
break;
case GI_INFO_TYPE_BOXED:
case GI_INFO_TYPE_STRUCT:
function_info = g_struct_info_find_method (
function_info = _find_struct_method (
(GIStructInfo *) namespace_info,
method);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment