GNOME Bugzilla – Bug 754549
vapigen generates incorrect nested structs for pointer-to-struct within struct
Last modified: 2018-05-22 15:27:27 UTC
I use vapigen to parse a .gir (generated by g-ir-scanner). The original code contains structs that contain pointer to other struct (see attached test case). The result is that vapigen generates nested structs without the pointer. Since structs are value types in vala, nested structs don't use pointers but childs are "inlined" into the parent structs. (btw, is there a way to enforce compact classes instead of structs?) I have a test case and a possible fix. The fix is simple but I'm unsure if the fix has unwanted side effects. I'm also not sure if the children need to be weak (?).
Created attachment 310628 [details] test source code
Created attachment 310629 [details] test program (too see the error in the generated C code)
Created attachment 310630 [details] GIR source file For reference, is generated from teststruct.h
Created attachment 310631 [details] makefile to run the test
Created attachment 310632 [details] [review] seemingly simple fix
Do not merge the patch, it breaks classes and strings. I'm working on an improved one.
-- 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/512.