GNOME Bugzilla – Bug 622711
GValue has incorrect size
Last modified: 2013-02-10 21:44:41 UTC
g-i thinks it's 12 when it's really 20. The .gir is already wrong: <field name="data" writable="1"> <array zero-terminated="0" c:type="any" fixed-size="2"> <type name="any"/> </array> </field> Instead of <type name="any"/> it should be the equivalent to: union { gint v_int; guint v_uint; glong v_long; gulong v_ulong; gint64 v_int64; guint64 v_uint64; gfloat v_float; gdouble v_double; gpointer v_pointer; } data[2];
Created attachment 164610 [details] [review] Add a GValueData typedef for the data member in GValue so that gobject-introspection can calculate correctly GValue's size. No idea how realistic is this solution. Also I guess that we want to make clear somehow that GValueData is not supposed to be really public.
The array item type for the field now reads as: <field name="data" writable="1"> <array zero-terminated="0" c:type="gpointer" fixed-size="2"> <type name="_Value__data__union"/> </array> </field> So may already be fixed. We just need to verify the correct struct size is given back from g_struct_info_get_size. Then we can remove the workaround in pygi-boxed.c:_pygi_boxed_alloc and close this ticket.
For a boxed GValue, verified: g_struct_info_get_size((GIStructInfo*)info) == sizeof(GValue) == 24