Skip to content

Fix inconsistencies when handling closure and destroy annotations

Corentin Noël requested to merge tintou/closure-destroy-fix into main

This fixes the inconsistencies in the resulting annotations:

/**
 * tiny_test_object_foreach0:
 * @self: a #TinyTestObject
 * @callback: (scope call):
 * @user_data:
 */
void tiny_test_object_foreach0 (TinyTestObject           *self,
                                TinyTestObjectForeachFunc callback,
                                gpointer                  user_data);

resulted in callback having a closure=1 and user_data having nothing

when this:

/**
 * tiny_test_object_foreach1:
 * @self: a #TinyTestObject
 * @callback1: (scope call):
 * @user_data1: (closure callback1):
 */
void tiny_test_object_foreach1 (TinyTestObject           *self,
                                TinyTestObjectForeachFunc callback1,
                                gpointer                  user_data1);

resulted in user_data1 having a closure=0 and callback1 having nothing

The closure=X parameter is now properly added to the function pointer in all cases (as the first example is the most common use case)

The same mechanism is used for the destroy annotation

Merge request reports