Skip to content

Fix ref-counting for compact classes

Custom ref-counting in compact classes is broken since #670 (closed). The reason is that G_DEFINE_AUTOPTR_CLEANUP_FUNC is generated before the unref-method is emitted.

This fix defers emitting G_DEFINE_AUTOPTR_CLEANUP_FUNC when a compact class is annotated with a ccode unref_function.

Additionally, duplicate free-function declarations are avoided, which lead to c compiler warnings that prevent the unit test from passing.

Merge request reports