Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.9
-
Linux x86, glib 2.34 (latest)
-
Patch Available
Description
The function generate_deserialize_list_element() has a functional bug. It uses the following code to append a new element while deserializing.
out << "g_array_append_val (" << prefix << ", " << elem << ");" << endl
g_array_append_val() is a macro is glib which expects an array element, whereas "elem" in generate_deserialize_list_element() is a pointer to the array element. Deserialization doesn't work because of it. I don't think this part of the code was ever tested. I don't see any test or example code in c_glib which use lists.
One way to fix this is to use the glib API g_array_append_vals() instead. (BTW, g_array_append_val() is a wrapper macro which uses g_array_append_vals() internally). I'll attach the patch. It's been tested already.