[gtkada] Bug in glib-types.ads
Emmanuel Briot
briot at adacore.com
Fri Jun 13 08:33:55 CEST 2014
> Bug in glib-types.ads :
>
> procedure Class_Unref (T : GType);
>
> should be :
>
> procedure Class_Unref (C : GObject_Class);
>
> As per gnome doc
> https://developer.gnome.org/gobject/2.40/gobject-Type-Information.html#g-type-class-unref
>
> void
> g_type_class_unref (gpointer g_class);
>
> However, this bug should not concern many applications as this function is not widely used. (only a possible memory leak)
The argument to g_type_class_unref is really a GTypeClass*, which is a pointer to a
struct _GTypeClass
{
/*< private >*/
GType g_type;
};
Later on we have
struct _GObjectClass
{
GTypeClass g_type_class;
...
}
Based on C's nice (hum) unsafe casts, a GTypeClass* therefore can be used as a GType*, so I think the
GtkAda binding is actually correct here.
On the whole, I am now too sure why we actually bound that procedure at all, I think it is useless for
all applications (there are no memory leaks here, since this function will be called automatically by
gtk+ whenever it is needed, unless you specifically did a Class_Peek before.
regards
Emmanuel
More information about the gtkada
mailing list