What is wrong with g_enum_complete_type_info and

g_flags_complete_type_info?

Since four years we get the message

Caution: No free/unref found for   (g_enum_complete_type_info)
Caution: No free/unref found for   (g_flags_complete_type_info)

whenever we install the Nim GTK bindings, so maybe it is time to investigate the issue.

There must be something special about these two functions, as all the thousand other ones are fine.

The issue is about GTypeInfo deallocation in https://developer.gnome.org/gobject/stable/gobject-Enumeration-and-Flag-Types.html#g-enum-complete-type-info.

As I was not able to find a free() function I just visited gitlab:

https://gitlab.gnome.org/GNOME/glib/-/blob/master/gobject/genums.c#L266

https://gitlab.gnome.org/GNOME/glib/-/blob/master/gobject/genums.c#L312

My english is not that good, but may

@info: (out callee-allocates)

be wrong. May it be caller?

1 Like

Yeah, I think you are correct - those arguments should be caller-allocates. For example, g_type_module_register_enum certainly uses a stack-allocated GTypeInfo and asks g_enum_complete_type_info to fill it in. Paging @pwithnall.

1 Like

Indeed. Please feel free to submit a merge request to update the annotations :slight_smile:

1 Like

These functions also seem like something that shouldn’t get directly exposed in bindings like this. It’s part of the dynamic/plugin type machinery and that’s going to need properly integrated manual bindings to be usable nicely and safely.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.