Which transfer to use with a GPtrArray

I’m returning a GPtrArray in a function, and I’m not sure which transfer do I have to put in introspection data. The GPtrArray is created with g_ptr_array_new_full, thus calling g_ptr_array_unref in the last reference will free the GPtrArray and all its elements. Also, I’m returning it after doing a g_ptr_array_ref. I presume that the answer is “full”, but just to be sure.

Don’t: Writing Bindable APIs — GObject Introspection

Also: halting problem : Writing Bindable API, 2023 Edition

Use GPtrArray as an array builder, and then turn its contents into a C array at the API boundary.

1 Like