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 622711 - GValue has incorrect size
GValue has incorrect size
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gobject
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-06-25 10:55 UTC by Tomeu Vizoso
Modified: 2013-02-10 21:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add a GValueData typedef for the data member in GValue so that gobject-introspection can calculate correctly GValue's size. (1.36 KB, patch)
2010-06-25 11:37 UTC, Tomeu Vizoso
none Details | Review

Description Tomeu Vizoso 2010-06-25 10:55:08 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];
Comment 1 Tomeu Vizoso 2010-06-25 11:37:03 UTC
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.
Comment 2 Simon Feltman 2013-02-10 10:12:56 UTC
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.
Comment 3 Simon Feltman 2013-02-10 21:39:28 UTC
For a boxed GValue, verified:
g_struct_info_get_size((GIStructInfo*)info) == sizeof(GValue) == 24