GNOME Bugzilla – Bug 754550
GIR output lacks internal fields, typelib becomes ABI-incompatible
Last modified: 2018-05-22 15:27:52 UTC
In the generate C, the internal fields of a class are in the public struct definition (see https://bugzilla.gnome.org/show_bug.cgi?id=697777). However, the GIR output lacks these internal fields entirely. The result is that the typelib doesn't know about it when accessing members that come after the internal fields, and thus accesses wrong members. Attached is a test case, generate with valac --vapi=test.vapi --gir=Test-1.0.^Cr test.vala --library test
Created attachment 310633 [details] test source code
Created attachment 310634 [details] GIR file See how the GIR contains the priv field (for Klass::a), but then follows Klass::c immediately. Any python script trying to use the public c member will get incorrect results (i.e. the value of b).
Created attachment 310635 [details] [review] proposed fix Simple fix. Unfortunately there is no way to mark internal fields in .gir as far as I know.
Yes that's true for fields because it breaks ABI. However modifying that check_accessibility will also make other structures (like classes) public in the gir. Perhaps that check should be only added to visit_field.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/513.