structinfo: Fix offset in find_method()

The current offset only considers the fields themselves, but not
the optional embedded type that may follow each field.

Use the existing helper function instead of computing the offset
to fix the issue.
This commit is contained in:
Florian Müllner 2019-08-14 23:09:52 +02:00
parent 8958f167bf
commit e0f9f94a7e

View File

@ -215,12 +215,9 @@ g_struct_info_find_method (GIStructInfo *info,
{
gint offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
offset = rinfo->offset + header->struct_blob_size
+ blob->n_fields * header->field_blob_size;
offset = g_struct_get_field_offset (info, blob->n_fields);
return _g_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
}