summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2019-08-14 23:09:52 +0200
committerFlorian Müllner <fmuellner@gnome.org>2019-08-14 23:17:54 +0200
commit722d59c14cd0a82a0373fb305d0157f5281c076e (patch)
treea744ae294ba80ce0f9c1241cf4467fd4678fa2e5
parentc1f4af2830ff636fa32c36964f7ee7f78d94824b (diff)
downloadgobject-introspection-722d59c14cd0a82a0373fb305d0157f5281c076e.tar.gz
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.
-rw-r--r--girepository/gistructinfo.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/girepository/gistructinfo.c b/girepository/gistructinfo.c
index 7db417fc..a1edfa9f 100644
--- a/girepository/gistructinfo.c
+++ b/girepository/gistructinfo.c
@@ -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);
}