nih-dbus-tool generates invalid c code for structure types
Bug #803587 reported by
James Hunt
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libnih |
In Progress
|
Undecided
|
Unassigned |
Bug Description
A method specifying an array of structs will generate invalid C code. In XML:
<method name="foo">
<arg name="bar" type="a(sa(s)a(s))" direction="out" />
</method>
To post a comment you must log in.
This is caused by a bug in the code; instead of adding the structure definitions to a temporary "item_structs" list, then copying it to "structs" it was simply adding them directly to "structs".
The problem with that was that they were "local" variables and freed on returning from the function, cleanly removed from that linked list in the process. The temporary list and copy added the reference to make them non-local.
In the process also fixed a second bug where the structure definitions were added *after* their parent, not before.