[vala/0.54] codegen: Emit G_DEFINE_AUTOPTR_CLEANUP_FUNC() for interfaces with base class



commit 2718b327f90f0ead350ee3f95d3ac9d8dbe6503f
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Feb 24 13:45:18 2022 +0100

    codegen: Emit G_DEFINE_AUTOPTR_CLEANUP_FUNC() for interfaces with base class
    
    Fixes https://gitlab.gnome.org/GNOME/vala/issues/1292

 codegen/valagtypemodule.vala                               | 13 ++++++++++++-
 tests/annotations/deprecated.c-expected                    |  1 +
 tests/asynchronous/bug614294.c-expected                    |  1 +
 tests/asynchronous/bug646945.c-expected                    |  1 +
 tests/asynchronous/bug652252.c-expected                    |  1 +
 tests/asynchronous/nowrapper.c-expected                    |  1 +
 tests/dbus/arrays_client.c-expected                        |  1 +
 tests/dbus/async-bus_client.c-expected                     |  1 +
 tests/dbus/async-connection_client.c-expected              |  1 +
 tests/dbus/async-errors_client.c-expected                  |  1 +
 tests/dbus/async-no-reply_client.c-expected                |  1 +
 tests/dbus/async_client.c-expected                         |  1 +
 tests/dbus/basic-types_client.c-expected                   |  1 +
 tests/dbus/bug602003_client.c-expected                     |  1 +
 tests/dbus/bug735437_client.c-expected                     |  1 +
 tests/dbus/bug782719_client.c-expected                     |  1 +
 tests/dbus/bug783002_client.c-expected                     |  1 +
 tests/dbus/bug792277.c-expected                            |  1 +
 tests/dbus/connection_client.c-expected                    |  1 +
 tests/dbus/dicts_client.c-expected                         |  1 +
 tests/dbus/dicts_server.c-expected                         |  1 +
 tests/dbus/enum-string-marshalling.c-expected              |  1 +
 tests/dbus/errors_client.c-expected                        |  1 +
 tests/dbus/filedescriptor-async_client.c-expected          |  1 +
 tests/dbus/filedescriptor-errors_client.c-expected         |  1 +
 tests/dbus/filedescriptor_client.c-expected                |  1 +
 tests/dbus/generics_client.c-expected                      |  1 +
 tests/dbus/interface-info_client.c-expected                |  1 +
 tests/dbus/no-reply_client.c-expected                      |  1 +
 tests/dbus/rawvariants_client.c-expected                   |  2 ++
 tests/dbus/signals_client.c-expected                       |  1 +
 tests/dbus/structs_client.c-expected                       |  1 +
 tests/delegates/compatible.c-expected                      |  1 +
 tests/delegates/delegates.c-expected                       |  1 +
 tests/generics/bug640330.c-expected                        |  1 +
 tests/genie/interface.c-expected                           |  1 +
 tests/methods/bug648320.c-expected                         |  1 +
 tests/methods/bug652098.c-expected                         |  3 +++
 tests/methods/generics.c-expected                          |  1 +
 tests/methods/nowrapper-interface.c-expected               |  1 +
 tests/objects/bug641828.c-expected                         |  1 +
 tests/objects/bug642809.c-expected                         |  1 +
 tests/objects/bug779219.c-expected                         |  1 +
 tests/objects/class-new-no-override.c-expected             |  1 +
 tests/objects/classes-implicit-implementation.c-expected   |  2 ++
 tests/objects/classes-interfaces-virtuals.c-expected       |  2 ++
 tests/objects/classes-interfaces.c-expected                |  2 ++
 tests/objects/instance-comparison.c-expected               |  1 +
 tests/objects/interface-abstract-async-override.c-expected |  1 +
 tests/objects/interface-async-captured-generic.c-expected  |  1 +
 tests/objects/interface-generics.c-expected                |  1 +
 tests/objects/interface-property-base-impl.c-expected      |  1 +
 tests/objects/interface-property-override.c-expected       |  1 +
 tests/objects/interface-virtual-override.c-expected        |  1 +
 tests/objects/interfaces.c-expected                        |  1 +
 tests/objects/methods.c-expected                           |  1 +
 tests/objects/properties.c-expected                        |  2 ++
 tests/objects/property-read-only-auto.c-expected           |  1 +
 tests/objects/signals-fundamental-return.c-expected        |  1 +
 tests/objects/signals-gobject-return.c-expected            |  1 +
 tests/objects/type-narrowing-fallback.c-expected           |  1 +
 tests/resolver/peek-inner-types.c-expected                 |  3 +++
 tests/structs/bug667890.c-expected                         |  1 +
 tests/structs/gvalue.c-expected                            |  1 +
 64 files changed, 84 insertions(+), 1 deletion(-)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 1f600afe3..28a29744c 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -2148,8 +2148,9 @@ public class Vala.GTypeModule : GErrorModule {
                decl_space.add_type_declaration (new CCodeTypeDefinition ("struct _%s".printf (get_ccode_name 
(iface)), new CCodeVariableDeclarator (get_ccode_name (iface))));
                decl_space.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf 
(type_struct.name), new CCodeVariableDeclarator (get_ccode_type_name (iface))));
 
+               unowned Class? prereq_cl = null;
                foreach (DataType prerequisite in iface.get_prerequisites ()) {
-                       unowned Class? prereq_cl = prerequisite.type_symbol as Class;
+                       prereq_cl = prerequisite.type_symbol as Class;
                        unowned Interface? prereq_iface = prerequisite.type_symbol as Interface;
                        if (prereq_cl != null) {
                                generate_class_declaration (prereq_cl, decl_space);
@@ -2216,6 +2217,16 @@ public class Vala.GTypeModule : GErrorModule {
                decl_space.add_type_member_declaration (type_fun.get_declaration ());
 
                requires_vala_extern = true;
+
+               if (prereq_cl != null) {
+                       var base_class = prereq_cl;
+                       while (base_class.base_class != null) {
+                               base_class = base_class.base_class;
+                       }
+                       // Custom unref-methods need to be emitted before G_DEFINE_AUTOPTR_CLEANUP_FUNC,
+                       // so we guard against that special case and handle it in generate_method_declaration.
+                       generate_autoptr_cleanup (iface, base_class, decl_space);
+               }
        }
 
        public override void visit_interface (Interface iface) {
diff --git a/tests/annotations/deprecated.c-expected b/tests/annotations/deprecated.c-expected
index 729cd82e4..d7844cc84 100644
--- a/tests/annotations/deprecated.c-expected
+++ b/tests/annotations/deprecated.c-expected
@@ -148,6 +148,7 @@ static gint afoo_real_fooa (AFoo* self) G_GNUC_DEPRECATED ;
 VALA_EXTERN AFoo* afoo_construct (GType object_type);
 static GType afoo_get_type_once (void);
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 VALA_EXTERN gint ifoo_foo (IFoo* self) G_GNUC_DEPRECATED ;
 VALA_EXTERN void ifoo_fooa (IFoo* self) G_GNUC_DEPRECATED ;
 static GType ifoo_get_type_once (void);
diff --git a/tests/asynchronous/bug614294.c-expected b/tests/asynchronous/bug614294.c-expected
index 4845677fd..e7fed1b77 100644
--- a/tests/asynchronous/bug614294.c-expected
+++ b/tests/asynchronous/bug614294.c-expected
@@ -231,6 +231,7 @@ static gpointer baz_parent_class = NULL;
 static gpointer sub_baz_parent_class = NULL;
 
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 VALA_EXTERN void ifoo_foo_async (IFoo* self,
                      GAsyncReadyCallback _callback_,
                      gpointer _user_data_);
diff --git a/tests/asynchronous/bug646945.c-expected b/tests/asynchronous/bug646945.c-expected
index 525f44f3c..059812076 100644
--- a/tests/asynchronous/bug646945.c-expected
+++ b/tests/asynchronous/bug646945.c-expected
@@ -137,6 +137,7 @@ VALA_EXTERN Foo* foo_new (void);
 VALA_EXTERN Foo* foo_construct (GType object_type);
 static GType foo_get_type_once (void);
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
 static void bar_real_method2_data_free (gpointer _data);
 static void bar_real_method2 (Bar* self,
                        GAsyncReadyCallback _callback_,
diff --git a/tests/asynchronous/bug652252.c-expected b/tests/asynchronous/bug652252.c-expected
index 7494b39ef..130644d03 100644
--- a/tests/asynchronous/bug652252.c-expected
+++ b/tests/asynchronous/bug652252.c-expected
@@ -76,6 +76,7 @@ static gpointer bar_parent_class = NULL;
 static FooIface * bar_foo_parent_iface = NULL;
 
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
 static void foo_real_foo_data_free (gpointer _data);
 static void foo_real_foo (Foo* self,
                    GAsyncReadyCallback _callback_,
diff --git a/tests/asynchronous/nowrapper.c-expected b/tests/asynchronous/nowrapper.c-expected
index 8b388a6ff..f329368d8 100644
--- a/tests/asynchronous/nowrapper.c-expected
+++ b/tests/asynchronous/nowrapper.c-expected
@@ -94,6 +94,7 @@ VALA_EXTERN GMainLoop* loop;
 GMainLoop* loop = NULL;
 
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 static GType ifoo_get_type_once (void);
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
diff --git a/tests/dbus/arrays_client.c-expected b/tests/dbus/arrays_client.c-expected
index 8c17358f0..92367812b 100644
--- a/tests/dbus/arrays_client.c-expected
+++ b/tests/dbus/arrays_client.c-expected
@@ -48,6 +48,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN gint* test_test_int (Test* self,
                      gint* i,
                      gint i_length1,
diff --git a/tests/dbus/async-bus_client.c-expected b/tests/dbus/async-bus_client.c-expected
index 5bc147231..1b409500d 100644
--- a/tests/dbus/async-bus_client.c-expected
+++ b/tests/dbus/async-bus_client.c-expected
@@ -48,6 +48,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN gint test_get_test (Test* self,
                     GError** error);
 static GType test_get_type_once (void);
diff --git a/tests/dbus/async-connection_client.c-expected b/tests/dbus/async-connection_client.c-expected
index 30ee60393..b96d7b7e6 100644
--- a/tests/dbus/async-connection_client.c-expected
+++ b/tests/dbus/async-connection_client.c-expected
@@ -48,6 +48,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN gint test_get_test (Test* self,
                     GError** error);
 static GType test_get_type_once (void);
diff --git a/tests/dbus/async-errors_client.c-expected b/tests/dbus/async-errors_client.c-expected
index 93025ba4a..3e5d988fd 100644
--- a/tests/dbus/async-errors_client.c-expected
+++ b/tests/dbus/async-errors_client.c-expected
@@ -102,6 +102,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN void test_test_void (Test* self,
                      GAsyncReadyCallback _callback_,
                      gpointer _user_data_);
diff --git a/tests/dbus/async-no-reply_client.c-expected b/tests/dbus/async-no-reply_client.c-expected
index abb397e7d..4e92668b5 100644
--- a/tests/dbus/async-no-reply_client.c-expected
+++ b/tests/dbus/async-no-reply_client.c-expected
@@ -129,6 +129,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN void test_list_messages (Test* self,
                          GAsyncReadyCallback _callback_,
                          gpointer _user_data_);
diff --git a/tests/dbus/async_client.c-expected b/tests/dbus/async_client.c-expected
index 5a52c2642..7323abbb7 100644
--- a/tests/dbus/async_client.c-expected
+++ b/tests/dbus/async_client.c-expected
@@ -100,6 +100,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN void test_test_void (Test* self,
                      GAsyncReadyCallback _callback_,
                      gpointer _user_data_);
diff --git a/tests/dbus/basic-types_client.c-expected b/tests/dbus/basic-types_client.c-expected
index fb410ddd1..f05900aa8 100644
--- a/tests/dbus/basic-types_client.c-expected
+++ b/tests/dbus/basic-types_client.c-expected
@@ -52,6 +52,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN void test_test_void (Test* self,
                      GError** error);
 VALA_EXTERN gint test_test_int (Test* self,
diff --git a/tests/dbus/bug602003_client.c-expected b/tests/dbus/bug602003_client.c-expected
index 86d159c79..421f4b1cd 100644
--- a/tests/dbus/bug602003_client.c-expected
+++ b/tests/dbus/bug602003_client.c-expected
@@ -46,6 +46,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN GVariant* test_test_string (Test* self,
                             GError** error);
 static GType test_get_type_once (void);
diff --git a/tests/dbus/bug735437_client.c-expected b/tests/dbus/bug735437_client.c-expected
index dae32bff8..0628ec36e 100644
--- a/tests/dbus/bug735437_client.c-expected
+++ b/tests/dbus/bug735437_client.c-expected
@@ -49,6 +49,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN gdouble* test_array (Test* self,
                      gint* result_length1,
                      GError** error);
diff --git a/tests/dbus/bug782719_client.c-expected b/tests/dbus/bug782719_client.c-expected
index 3c287d617..97670f943 100644
--- a/tests/dbus/bug782719_client.c-expected
+++ b/tests/dbus/bug782719_client.c-expected
@@ -47,6 +47,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN GHashTable* test_test_nested_dict (Test* self,
                                    GError** error);
 static GType test_get_type_once (void);
diff --git a/tests/dbus/bug783002_client.c-expected b/tests/dbus/bug783002_client.c-expected
index f87ad4c6a..afa5b06df 100644
--- a/tests/dbus/bug783002_client.c-expected
+++ b/tests/dbus/bug783002_client.c-expected
@@ -81,6 +81,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN void test_test_array_lifetime (Test* self,
                                gchar** items,
                                gint items_length1,
diff --git a/tests/dbus/bug792277.c-expected b/tests/dbus/bug792277.c-expected
index 63cea38d3..cfef67e0f 100644
--- a/tests/dbus/bug792277.c-expected
+++ b/tests/dbus/bug792277.c-expected
@@ -68,6 +68,7 @@ VALA_EXTERN guint ifoo_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 VALA_EXTERN void ifoo_method0 (IFoo* self,
                    GError** error);
 VALA_EXTERN void ifoo_method1 (IFoo* self,
diff --git a/tests/dbus/connection_client.c-expected b/tests/dbus/connection_client.c-expected
index d25dbb971..ba855bb32 100644
--- a/tests/dbus/connection_client.c-expected
+++ b/tests/dbus/connection_client.c-expected
@@ -44,6 +44,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN gint test_get_test (Test* self,
                     GError** error);
 static GType test_get_type_once (void);
diff --git a/tests/dbus/dicts_client.c-expected b/tests/dbus/dicts_client.c-expected
index 16a66e5c4..7d085ec04 100644
--- a/tests/dbus/dicts_client.c-expected
+++ b/tests/dbus/dicts_client.c-expected
@@ -47,6 +47,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN GHashTable* test_test_dict (Test* self,
                             GError** error);
 static GType test_get_type_once (void);
diff --git a/tests/dbus/dicts_server.c-expected b/tests/dbus/dicts_server.c-expected
index 90cafa765..fe6f13c81 100644
--- a/tests/dbus/dicts_server.c-expected
+++ b/tests/dbus/dicts_server.c-expected
@@ -145,6 +145,7 @@ VALA_EXTERN guint test_interface_bar_register_object (void* object,
                                           const gchar* path,
                                           GError** error);
 VALA_EXTERN GType test_interface_bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (TestInterfaceBar, g_object_unref)
 VALA_EXTERN GHashTable* test_interface_bar_foo (TestInterfaceBar* self,
                                     GError** error);
 static GType test_interface_bar_get_type_once (void);
diff --git a/tests/dbus/enum-string-marshalling.c-expected b/tests/dbus/enum-string-marshalling.c-expected
index bf75b7b5a..6de15c4ef 100644
--- a/tests/dbus/enum-string-marshalling.c-expected
+++ b/tests/dbus/enum-string-marshalling.c-expected
@@ -67,6 +67,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN void test_test1 (Test* self,
                  FooEnum e,
                  GAsyncReadyCallback _callback_,
diff --git a/tests/dbus/errors_client.c-expected b/tests/dbus/errors_client.c-expected
index 8971ec0c1..75776f33d 100644
--- a/tests/dbus/errors_client.c-expected
+++ b/tests/dbus/errors_client.c-expected
@@ -58,6 +58,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN void test_test_void (Test* self,
                      GError** error);
 VALA_EXTERN gint test_test_int (Test* self,
diff --git a/tests/dbus/filedescriptor-async_client.c-expected 
b/tests/dbus/filedescriptor-async_client.c-expected
index 5d00e4e24..080e712a1 100644
--- a/tests/dbus/filedescriptor-async_client.c-expected
+++ b/tests/dbus/filedescriptor-async_client.c-expected
@@ -117,6 +117,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN void test_test_in (Test* self,
                    GUnixInputStream* i,
                    GAsyncReadyCallback _callback_,
diff --git a/tests/dbus/filedescriptor-errors_client.c-expected 
b/tests/dbus/filedescriptor-errors_client.c-expected
index 561f3d7ba..4986cd81e 100644
--- a/tests/dbus/filedescriptor-errors_client.c-expected
+++ b/tests/dbus/filedescriptor-errors_client.c-expected
@@ -46,6 +46,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN gchar* test_test (Test* self,
                   GUnixOutputStream* output_stream,
                   GError** error);
diff --git a/tests/dbus/filedescriptor_client.c-expected b/tests/dbus/filedescriptor_client.c-expected
index 0bde11a8b..08914080c 100644
--- a/tests/dbus/filedescriptor_client.c-expected
+++ b/tests/dbus/filedescriptor_client.c-expected
@@ -47,6 +47,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN GUnixInputStream* test_test_in (Test* self,
                                 GUnixInputStream* i,
                                 GUnixInputStream** j,
diff --git a/tests/dbus/generics_client.c-expected b/tests/dbus/generics_client.c-expected
index eaada2f07..939c7390e 100644
--- a/tests/dbus/generics_client.c-expected
+++ b/tests/dbus/generics_client.c-expected
@@ -45,6 +45,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN gint test_get_test (Test* self,
                     GError** error);
 static GType test_get_type_once (void);
diff --git a/tests/dbus/interface-info_client.c-expected b/tests/dbus/interface-info_client.c-expected
index 9ae2ff2b7..6c925c7ad 100644
--- a/tests/dbus/interface-info_client.c-expected
+++ b/tests/dbus/interface-info_client.c-expected
@@ -48,6 +48,7 @@ VALA_EXTERN GMainLoop* main_loop;
 GMainLoop* main_loop = NULL;
 
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN guint test_register_object (void* object,
                             GDBusConnection* connection,
diff --git a/tests/dbus/no-reply_client.c-expected b/tests/dbus/no-reply_client.c-expected
index 106c9a2b2..de9917d32 100644
--- a/tests/dbus/no-reply_client.c-expected
+++ b/tests/dbus/no-reply_client.c-expected
@@ -117,6 +117,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN gchar** test_list_messages (Test* self,
                             gint* result_length1,
                             GError** error);
diff --git a/tests/dbus/rawvariants_client.c-expected b/tests/dbus/rawvariants_client.c-expected
index 287614547..7fc089636 100644
--- a/tests/dbus/rawvariants_client.c-expected
+++ b/tests/dbus/rawvariants_client.c-expected
@@ -91,6 +91,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN gint test_test_method (Test* self,
                        gint j,
                        gint k,
@@ -152,6 +153,7 @@ VALA_EXTERN guint test_raw_register_object (void* object,
                                 const gchar* path,
                                 GError** error);
 VALA_EXTERN GType test_raw_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (TestRaw, g_object_unref)
 VALA_EXTERN GVariant* test_raw_test_method (TestRaw* self,
                                 GVariant* j,
                                 GVariant* k,
diff --git a/tests/dbus/signals_client.c-expected b/tests/dbus/signals_client.c-expected
index b172477d0..327f06ea1 100644
--- a/tests/dbus/signals_client.c-expected
+++ b/tests/dbus/signals_client.c-expected
@@ -57,6 +57,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN void test_do_foo (Test* self,
                   gint i,
                   GError** error);
diff --git a/tests/dbus/structs_client.c-expected b/tests/dbus/structs_client.c-expected
index 91c61053a..f2a1411e3 100644
--- a/tests/dbus/structs_client.c-expected
+++ b/tests/dbus/structs_client.c-expected
@@ -65,6 +65,7 @@ VALA_EXTERN guint test_register_object (void* object,
                             const gchar* path,
                             GError** error);
 VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN void test_test_struct (Test* self,
                        FooStruct* f,
                        FooStruct* g,
diff --git a/tests/delegates/compatible.c-expected b/tests/delegates/compatible.c-expected
index 249a05609..ee7bce280 100644
--- a/tests/delegates/compatible.c-expected
+++ b/tests/delegates/compatible.c-expected
@@ -59,6 +59,7 @@ static gpointer bar_parent_class = NULL;
 static FooIface * bar_foo_parent_iface = NULL;
 
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
 VALA_EXTERN void foo_foo (Foo* self,
               Func func,
               gpointer func_target);
diff --git a/tests/delegates/delegates.c-expected b/tests/delegates/delegates.c-expected
index ae52846d0..d787b8d9f 100644
--- a/tests/delegates/delegates.c-expected
+++ b/tests/delegates/delegates.c-expected
@@ -94,6 +94,7 @@ VALA_EXTERN GType maman_delegate_struct_get_type (void) G_GNUC_CONST ;
 VALA_EXTERN MamanDelegateStruct* maman_delegate_struct_dup (const MamanDelegateStruct* self);
 VALA_EXTERN void maman_delegate_struct_free (MamanDelegateStruct* self);
 VALA_EXTERN GType maman_foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanFoo, g_object_unref)
 VALA_EXTERN void maman_foo_foo_method (MamanFoo* self,
                            gint i);
 static GType maman_foo_get_type_once (void);
diff --git a/tests/generics/bug640330.c-expected b/tests/generics/bug640330.c-expected
index 58433fd45..313cf24ba 100644
--- a/tests/generics/bug640330.c-expected
+++ b/tests/generics/bug640330.c-expected
@@ -77,6 +77,7 @@ static gpointer bar_parent_class = NULL;
 static FooIface * bar_foo_parent_iface = NULL;
 
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
 VALA_EXTERN gpointer foo_get_foo (Foo* self,
                       gconstpointer g);
 static gpointer foo_real_get_foo (Foo* self,
diff --git a/tests/genie/interface.c-expected b/tests/genie/interface.c-expected
index 77b98c6fc..a96884723 100644
--- a/tests/genie/interface.c-expected
+++ b/tests/genie/interface.c-expected
@@ -69,6 +69,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref)
 VALA_EXTERN Test* test_new (void);
 VALA_EXTERN Test* test_construct (GType object_type);
 VALA_EXTERN GType itest_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (ITest, g_object_unref)
 VALA_EXTERN gboolean itest_test (ITest* self,
                      gint a);
 static GType itest_get_type_once (void);
diff --git a/tests/methods/bug648320.c-expected b/tests/methods/bug648320.c-expected
index 272b547c8..40f55db0d 100644
--- a/tests/methods/bug648320.c-expected
+++ b/tests/methods/bug648320.c-expected
@@ -37,6 +37,7 @@ struct _Block1Data {
 };
 
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
 VALA_EXTERN void foo_foo (Foo* self);
 static Block1Data* block1_data_ref (Block1Data* _data1_);
 static void block1_data_unref (void * _userdata_);
diff --git a/tests/methods/bug652098.c-expected b/tests/methods/bug652098.c-expected
index 81acc0910..c6c1cb424 100644
--- a/tests/methods/bug652098.c-expected
+++ b/tests/methods/bug652098.c-expected
@@ -169,9 +169,11 @@ static gpointer concrete_parent_class = NULL;
 static IfaceIface * concrete_iface_parent_iface = NULL;
 
 VALA_EXTERN GType iface1_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Iface1, g_object_unref)
 VALA_EXTERN gint iface1_foo (Iface1* self);
 static GType iface1_get_type_once (void);
 VALA_EXTERN GType iface2_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Iface2, g_object_unref)
 VALA_EXTERN gint iface2_foo (Iface2* self);
 static GType iface2_get_type_once (void);
 VALA_EXTERN GType obj1_get_type (void) G_GNUC_CONST ;
@@ -195,6 +197,7 @@ VALA_EXTERN Base* base_new (void);
 VALA_EXTERN Base* base_construct (GType object_type);
 static GType base_get_type_once (void);
 VALA_EXTERN GType iface_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Iface, g_object_unref)
 VALA_EXTERN gint iface_foo (Iface* self);
 static GType iface_get_type_once (void);
 VALA_EXTERN GType concrete_get_type (void) G_GNUC_CONST ;
diff --git a/tests/methods/generics.c-expected b/tests/methods/generics.c-expected
index 5cf5065b2..d2dafb798 100644
--- a/tests/methods/generics.c-expected
+++ b/tests/methods/generics.c-expected
@@ -90,6 +90,7 @@ static gpointer baz_parent_class = NULL;
 static FooIface * baz_foo_parent_iface = NULL;
 
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
 VALA_EXTERN void foo_foo (Foo* self,
               GType t_type,
               GBoxedCopyFunc t_dup_func,
diff --git a/tests/methods/nowrapper-interface.c-expected b/tests/methods/nowrapper-interface.c-expected
index a3ba046f3..72faa1f09 100644
--- a/tests/methods/nowrapper-interface.c-expected
+++ b/tests/methods/nowrapper-interface.c-expected
@@ -61,6 +61,7 @@ static gpointer foo_parent_class = NULL;
 static IFooIface * foo_ifoo_parent_iface = NULL;
 
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 static GType ifoo_get_type_once (void);
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
diff --git a/tests/objects/bug641828.c-expected b/tests/objects/bug641828.c-expected
index cc9b533ec..84e6cc9b0 100644
--- a/tests/objects/bug641828.c-expected
+++ b/tests/objects/bug641828.c-expected
@@ -65,6 +65,7 @@ static gpointer foo_parent_class = NULL;
 static BarIface * foo_bar_parent_iface = NULL;
 
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
 static void g_cclosure_user_marshal_INT__INT (GClosure * closure,
                                        GValue * return_value,
                                        guint n_param_values,
diff --git a/tests/objects/bug642809.c-expected b/tests/objects/bug642809.c-expected
index 1ca3ce361..338eff9b1 100644
--- a/tests/objects/bug642809.c-expected
+++ b/tests/objects/bug642809.c-expected
@@ -88,6 +88,7 @@ static gpointer manam_parent_class = NULL;
 static FooIface * manam_foo_parent_iface = NULL;
 
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
 static void foo_real_virtual_signal (Foo* self);
 static GType foo_get_type_once (void);
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
diff --git a/tests/objects/bug779219.c-expected b/tests/objects/bug779219.c-expected
index e16787701..7beb224ed 100644
--- a/tests/objects/bug779219.c-expected
+++ b/tests/objects/bug779219.c-expected
@@ -90,6 +90,7 @@ static IFooIface * foo_ifoo_parent_iface = NULL;
 static gpointer bar_parent_class = NULL;
 
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 VALA_EXTERN gint ifoo_get_foo (IFoo* self);
 static GType ifoo_get_type_once (void);
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
diff --git a/tests/objects/class-new-no-override.c-expected b/tests/objects/class-new-no-override.c-expected
index 370467a68..2fb2b7583 100644
--- a/tests/objects/class-new-no-override.c-expected
+++ b/tests/objects/class-new-no-override.c-expected
@@ -64,6 +64,7 @@ static gpointer bar_parent_class = NULL;
 static IFooIface * bar_ifoo_parent_iface = NULL;
 
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 VALA_EXTERN void ifoo_foo (IFoo* self,
                gint i);
 static void ifoo_real_foo (IFoo* self,
diff --git a/tests/objects/classes-implicit-implementation.c-expected 
b/tests/objects/classes-implicit-implementation.c-expected
index bbd01232f..57bf0e675 100644
--- a/tests/objects/classes-implicit-implementation.c-expected
+++ b/tests/objects/classes-implicit-implementation.c-expected
@@ -153,9 +153,11 @@ static IFooIface * faz_ifoo_parent_iface = NULL;
 static IBarIface * faz_ibar_parent_iface = NULL;
 
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 VALA_EXTERN gint ifoo_foo (IFoo* self);
 static GType ifoo_get_type_once (void);
 VALA_EXTERN GType ibar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IBar, g_object_unref)
 static GType ibar_get_type_once (void);
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
diff --git a/tests/objects/classes-interfaces-virtuals.c-expected 
b/tests/objects/classes-interfaces-virtuals.c-expected
index e277df490..d7941efef 100644
--- a/tests/objects/classes-interfaces-virtuals.c-expected
+++ b/tests/objects/classes-interfaces-virtuals.c-expected
@@ -105,9 +105,11 @@ static IBarIface * foo_ibar_parent_iface = NULL;
 static gpointer bar_parent_class = NULL;
 
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 VALA_EXTERN gint ifoo_foo (IFoo* self);
 static GType ifoo_get_type_once (void);
 VALA_EXTERN GType ibar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IBar, g_object_unref)
 VALA_EXTERN gchar* ibar_foo (IBar* self);
 static GType ibar_get_type_once (void);
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
diff --git a/tests/objects/classes-interfaces.c-expected b/tests/objects/classes-interfaces.c-expected
index 9cf514654..64ad86991 100644
--- a/tests/objects/classes-interfaces.c-expected
+++ b/tests/objects/classes-interfaces.c-expected
@@ -110,9 +110,11 @@ VALA_EXTERN Base* base_new (void);
 VALA_EXTERN Base* base_construct (GType object_type);
 static GType base_get_type_once (void);
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 VALA_EXTERN gchar* ifoo_foo (IFoo* self);
 static GType ifoo_get_type_once (void);
 VALA_EXTERN GType ibar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IBar, g_object_unref)
 VALA_EXTERN gint ibar_foo (IBar* self);
 static GType ibar_get_type_once (void);
 VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
diff --git a/tests/objects/instance-comparison.c-expected b/tests/objects/instance-comparison.c-expected
index 9238e1667..970d4c629 100644
--- a/tests/objects/instance-comparison.c-expected
+++ b/tests/objects/instance-comparison.c-expected
@@ -122,6 +122,7 @@ static IFooIface * baz_ifoo_parent_iface = NULL;
 static IFazIface * baz_ifaz_parent_iface = NULL;
 
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 static GType ifoo_get_type_once (void);
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
diff --git a/tests/objects/interface-abstract-async-override.c-expected 
b/tests/objects/interface-abstract-async-override.c-expected
index af4f79c49..030238c8f 100644
--- a/tests/objects/interface-abstract-async-override.c-expected
+++ b/tests/objects/interface-abstract-async-override.c-expected
@@ -76,6 +76,7 @@ VALA_EXTERN GMainLoop* loop;
 GMainLoop* loop = NULL;
 
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 VALA_EXTERN void ifoo_foo (IFoo* self,
                GAsyncReadyCallback _callback_,
                gpointer _user_data_);
diff --git a/tests/objects/interface-async-captured-generic.c-expected 
b/tests/objects/interface-async-captured-generic.c-expected
index 1db37f741..a2cf79f00 100644
--- a/tests/objects/interface-async-captured-generic.c-expected
+++ b/tests/objects/interface-async-captured-generic.c-expected
@@ -77,6 +77,7 @@ static gpointer foo_parent_class = NULL;
 static IFooIface * foo_ifoo_parent_iface = NULL;
 
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 static void ifoo_bar_data_free (gpointer _data);
 VALA_EXTERN void ifoo_bar (IFoo* self,
                gpointer g,
diff --git a/tests/objects/interface-generics.c-expected b/tests/objects/interface-generics.c-expected
index bbff3c659..097f5d5d9 100644
--- a/tests/objects/interface-generics.c-expected
+++ b/tests/objects/interface-generics.c-expected
@@ -66,6 +66,7 @@ static gpointer foo_parent_class = NULL;
 static IFooIface * foo_ifoo_parent_iface = NULL;
 
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 VALA_EXTERN gpointer ifoo_get (IFoo* self);
 static GType ifoo_get_type_once (void);
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
diff --git a/tests/objects/interface-property-base-impl.c-expected 
b/tests/objects/interface-property-base-impl.c-expected
index 02657c92d..83d996a08 100644
--- a/tests/objects/interface-property-base-impl.c-expected
+++ b/tests/objects/interface-property-base-impl.c-expected
@@ -95,6 +95,7 @@ static gpointer bar_parent_class = NULL;
 static IFooIface * bar_ifoo_parent_iface = NULL;
 
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 VALA_EXTERN gint ifoo_get_prop (IFoo* self);
 VALA_EXTERN void ifoo_set_prop (IFoo* self,
                     gint value);
diff --git a/tests/objects/interface-property-override.c-expected 
b/tests/objects/interface-property-override.c-expected
index d380c2ad8..4ffe1f31a 100644
--- a/tests/objects/interface-property-override.c-expected
+++ b/tests/objects/interface-property-override.c-expected
@@ -130,6 +130,7 @@ VALA_EXTERN Foo* foo_construct (GType object_type);
 static void foo_finalize (Foo * obj);
 static GType foo_get_type_once (void);
 VALA_EXTERN GType ibar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IBar, g_object_unref)
 VALA_EXTERN gint ibar_get_foo (IBar* self);
 VALA_EXTERN void ibar_set_foo (IBar* self,
                    gint value);
diff --git a/tests/objects/interface-virtual-override.c-expected 
b/tests/objects/interface-virtual-override.c-expected
index 69868337c..25662b76b 100644
--- a/tests/objects/interface-virtual-override.c-expected
+++ b/tests/objects/interface-virtual-override.c-expected
@@ -87,6 +87,7 @@ VALA_EXTERN GMainLoop* loop;
 GMainLoop* loop = NULL;
 
 VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
 VALA_EXTERN gint ifoo_foo (IFoo* self);
 static gint ifoo_real_foo (IFoo* self);
 static void ifoo_real_bar_data_free (gpointer _data);
diff --git a/tests/objects/interfaces.c-expected b/tests/objects/interfaces.c-expected
index d328b8d18..7581299bf 100644
--- a/tests/objects/interfaces.c-expected
+++ b/tests/objects/interfaces.c-expected
@@ -86,6 +86,7 @@ static MamanIbazIface * maman_baz_maman_ibaz_parent_iface = NULL;
 static gpointer maman_sub_baz_parent_class = NULL;
 
 VALA_EXTERN GType maman_ibaz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanIbaz, g_object_unref)
 VALA_EXTERN void maman_ibaz_do_action (MamanIbaz* self);
 VALA_EXTERN void maman_ibaz_do_virtual_action (MamanIbaz* self);
 VALA_EXTERN void maman_ibaz_protected_mixin_1 (MamanIbaz* self);
diff --git a/tests/objects/methods.c-expected b/tests/objects/methods.c-expected
index 51af592e8..e656f2c33 100644
--- a/tests/objects/methods.c-expected
+++ b/tests/objects/methods.c-expected
@@ -403,6 +403,7 @@ VALA_EXTERN MamanDeepDerived* maman_deep_derived_new (void);
 VALA_EXTERN MamanDeepDerived* maman_deep_derived_construct (GType object_type);
 static GType maman_deep_derived_get_type_once (void);
 VALA_EXTERN GType maman_base_access_ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanBaseAccessIFoo, g_object_unref)
 VALA_EXTERN gint maman_base_access_ifoo_interface_method (MamanBaseAccessIFoo* self);
 VALA_EXTERN gint maman_base_access_ifoo_virtual_interface_method (MamanBaseAccessIFoo* self);
 static GType maman_base_access_ifoo_get_type_once (void);
diff --git a/tests/objects/properties.c-expected b/tests/objects/properties.c-expected
index e4931d146..acecc6461 100644
--- a/tests/objects/properties.c-expected
+++ b/tests/objects/properties.c-expected
@@ -388,6 +388,7 @@ static void sample_set_private_prop (Sample* self,
 static gint sample_main (void);
 VALA_EXTERN void maman_bar_run (void);
 VALA_EXTERN GType maman_ibaz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanIbaz, g_object_unref)
 VALA_EXTERN MamanBaz* maman_baz_new (void);
 VALA_EXTERN MamanBaz* maman_baz_construct (GType object_type);
 VALA_EXTERN GType maman_baz_get_type (void) G_GNUC_CONST ;
@@ -471,6 +472,7 @@ static void _vala_maman_baz_get_property (GObject * object,
                                    GValue * value,
                                    GParamSpec * pspec);
 VALA_EXTERN GType maman_ibiz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (MamanIBiz, g_object_unref)
 VALA_EXTERN gint maman_ibiz_get_number (MamanIBiz* self);
 VALA_EXTERN void maman_ibiz_set_number (MamanIBiz* self,
                             gint value);
diff --git a/tests/objects/property-read-only-auto.c-expected 
b/tests/objects/property-read-only-auto.c-expected
index ac3eb981e..63241b5eb 100644
--- a/tests/objects/property-read-only-auto.c-expected
+++ b/tests/objects/property-read-only-auto.c-expected
@@ -164,6 +164,7 @@ static void _vala_bar_get_property (GObject * object,
                              GValue * value,
                              GParamSpec * pspec);
 VALA_EXTERN GType ibaz_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IBaz, g_object_unref)
 VALA_EXTERN gint ibaz_get_read_only (IBaz* self);
 static GType ibaz_get_type_once (void);
 VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
diff --git a/tests/objects/signals-fundamental-return.c-expected 
b/tests/objects/signals-fundamental-return.c-expected
index 290075d8f..0310e665e 100644
--- a/tests/objects/signals-fundamental-return.c-expected
+++ b/tests/objects/signals-fundamental-return.c-expected
@@ -137,6 +137,7 @@ VALA_EXTERN Maman* maman_construct (GType object_type);
 static void maman_finalize (Maman * obj);
 static GType maman_get_type_once (void);
 VALA_EXTERN GType ibar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IBar, maman_unref)
 static GType ibar_get_type_once (void);
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, maman_unref)
diff --git a/tests/objects/signals-gobject-return.c-expected b/tests/objects/signals-gobject-return.c-expected
index a056b3f01..38716fe12 100644
--- a/tests/objects/signals-gobject-return.c-expected
+++ b/tests/objects/signals-gobject-return.c-expected
@@ -66,6 +66,7 @@ static gpointer foo_parent_class = NULL;
 static IBarIface * foo_ibar_parent_iface = NULL;
 
 VALA_EXTERN GType ibar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IBar, g_object_unref)
 static GType ibar_get_type_once (void);
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
diff --git a/tests/objects/type-narrowing-fallback.c-expected 
b/tests/objects/type-narrowing-fallback.c-expected
index d8b2495c0..e1f0770ed 100644
--- a/tests/objects/type-narrowing-fallback.c-expected
+++ b/tests/objects/type-narrowing-fallback.c-expected
@@ -88,6 +88,7 @@ static gpointer manam_parent_class = NULL;
 static FooIface * manam_foo_parent_iface = NULL;
 
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
 VALA_EXTERN gint foo_get_foo (Foo* self);
 static GType foo_get_type_once (void);
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
diff --git a/tests/resolver/peek-inner-types.c-expected b/tests/resolver/peek-inner-types.c-expected
index 3b471d8e2..f0daa48ca 100644
--- a/tests/resolver/peek-inner-types.c-expected
+++ b/tests/resolver/peek-inner-types.c-expected
@@ -196,10 +196,12 @@ VALA_EXTERN BazFooBar1* baz_foo_bar1_construct (GType object_type);
 static void baz_foo_bar1_finalize (BazFooBar1 * obj);
 static GType baz_foo_bar1_get_type_once (void);
 VALA_EXTERN GType baz_foo_ibar1_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BazFooIBar1, baz_foo_bar1_unref)
 static GType baz_foo_ibar1_get_type_once (void);
 static void baz_foo_finalize (BazFoo * obj);
 static GType baz_foo_get_type_once (void);
 VALA_EXTERN GType baz_ifoo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BazIFoo, baz_foo_unref)
 VALA_EXTERN gpointer baz_ifoo_bar2_ref (gpointer instance);
 VALA_EXTERN void baz_ifoo_bar2_unref (gpointer instance);
 VALA_EXTERN GParamSpec* baz_ifoo_param_spec_bar2 (const gchar* name,
@@ -219,6 +221,7 @@ VALA_EXTERN BazIFooBar2* baz_ifoo_bar2_construct (GType object_type);
 static void baz_ifoo_bar2_finalize (BazIFooBar2 * obj);
 static GType baz_ifoo_bar2_get_type_once (void);
 VALA_EXTERN GType baz_ifoo_ibar2_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (BazIFooIBar2, baz_ifoo_bar2_unref)
 static GType baz_ifoo_ibar2_get_type_once (void);
 static GType baz_ifoo_get_type_once (void);
 VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
diff --git a/tests/structs/bug667890.c-expected b/tests/structs/bug667890.c-expected
index 5ddc58ed0..e3bb9d6fc 100644
--- a/tests/structs/bug667890.c-expected
+++ b/tests/structs/bug667890.c-expected
@@ -34,6 +34,7 @@ struct _BarIface {
 };
 
 VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
 VALA_EXTERN Foo bar_bar (Bar* self);
 static GType bar_get_type_once (void);
 static void _vala_main (void);
diff --git a/tests/structs/gvalue.c-expected b/tests/structs/gvalue.c-expected
index 0caf6e916..8a54bd9f7 100644
--- a/tests/structs/gvalue.c-expected
+++ b/tests/structs/gvalue.c-expected
@@ -129,6 +129,7 @@ VALA_EXTERN Bar* bar_construct (GType object_type);
 static void bar_finalize (Bar * obj);
 static GType bar_get_type_once (void);
 VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, g_object_unref)
 static GType manam_get_type_once (void);
 VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]