After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 754549 - vapigen generates incorrect nested structs for pointer-to-struct within struct
vapigen generates incorrect nested structs for pointer-to-struct within struct
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: GObject Introspection
0.24.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2015-09-04 06:22 UTC by Thomas Martitz
Modified: 2018-05-22 15:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test source code (105 bytes, text/x-chdr)
2015-09-04 06:23 UTC, Thomas Martitz
  Details
test program (too see the error in the generated C code) (93 bytes, text/x-vala)
2015-09-04 06:24 UTC, Thomas Martitz
  Details
GIR source file (1.06 KB, application/xml)
2015-09-04 06:24 UTC, Thomas Martitz
  Details
makefile to run the test (358 bytes, text/plain)
2015-09-04 06:25 UTC, Thomas Martitz
  Details
seemingly simple fix (1.28 KB, patch)
2015-09-04 06:29 UTC, Thomas Martitz
none Details | Review

Description Thomas Martitz 2015-09-04 06:22:39 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 (?).
Comment 1 Thomas Martitz 2015-09-04 06:23:23 UTC
Created attachment 310628 [details]
test source code
Comment 2 Thomas Martitz 2015-09-04 06:24:16 UTC
Created attachment 310629 [details]
test program (too see the error in the generated C code)
Comment 3 Thomas Martitz 2015-09-04 06:24:59 UTC
Created attachment 310630 [details]
GIR source file

For reference, is generated from teststruct.h
Comment 4 Thomas Martitz 2015-09-04 06:25:17 UTC
Created attachment 310631 [details]
makefile to run the test
Comment 5 Thomas Martitz 2015-09-04 06:29:35 UTC
Created attachment 310632 [details] [review]
seemingly simple fix
Comment 6 Thomas Martitz 2015-09-04 22:49:08 UTC
Do not merge the patch, it breaks classes and strings. I'm working on an improved one.
Comment 7 GNOME Infrastructure Team 2018-05-22 15:27:27 UTC
-- 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.