gtk-rs / gtk-rs-core

Rust bindings for GNOME libraries
https://gtk-rs.org/gtk-rs-core
MIT License
279 stars 112 forks source link

GStaticRecMutex and other types are wrongly generated #1353

Closed sdroege closed 5 months ago

sdroege commented 5 months ago

Ubuntu issue: https://bugs.launchpad.net/ubuntu/+source/rust-glib-sys/+bug/2061202

(note that Ubuntu is regenerating against their own gir files but in this case it doesn't matter)

We generate it as

#[derive(Copy, Clone)]
#[repr(C)]
pub struct GStaticRecMutex {
    pub mutex: GStaticMutex,
    pub depth: c_uint,
}

Which is consistent with the .gir file. Unfortunately the gir file is incomplete though

struct _GStaticRecMutex
{
  /*< private >*/
  GStaticMutex mutex;
  guint depth;

  /* ABI compat only */
  union {
#ifdef G_OS_WIN32
    void *owner;
#else
    pthread_t owner;
#endif
    gdouble dummy;
  } unused;
} GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRecMutex);

Similarly the GStaticMutex struct and others are wrong.

sdroege commented 5 months ago

Relevant part of the gir file for reference

    <record name="StaticRecMutex" c:type="GStaticRecMutex" introspectable="0">
      <field name="mutex" readable="0" private="1">
        <type name="StaticMutex" c:type="GStaticMutex"/>
      </field>
      <field name="depth" readable="0" private="1">
        <type name="guint" c:type="guint"/>
      </field>
sdroege commented 5 months ago

As discussed on Matrix, we're just going to ignore those types. All this API is deprecated since a long time and it's not easy to fix at all.

bilelmoussaoui commented 5 months ago

This is now resolved in main