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



commit 612bded4642734554b7658c64d90ec1c3336006d
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 8b0619ad4..c867d18f8 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 ba31c9f46..d92b9a8fe 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 8eb5f5b13..baab03038 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 09097dfb5..a4337dce1 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 7f1f988c5..2424afda6 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 b6bc4b0f9..b46f5548d 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 8ad54f27f..dfac708c2 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 fba78c3c8..c76d0834d 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 955926973..573344551 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 c69a9b321..995bc1dc3 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 343fff00a..c108a12b8 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 e91779a44..71da10ef2 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 8bb99cf85..ec06c433f 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 faabb245d..dc44533a5 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 7fcc4b7e1..22512e652 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 3c3aedfcd..270f433d4 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 df47d4e3d..a9aca9d15 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 288d9a2cc..ad172cced 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 382bd9412..ad7130d8f 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 1cfde4f70..1e22e2c83 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 45bc09d0b..2694775d2 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 f7438c4b3..908ddc35c 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 9d6f2262a..b458ecf02 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 9b1a49f78..13e5b50bc 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 cba90e262..1a3a8473a 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 70ffe3afd..358753685 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 cd56a52eb..3822e2dc3 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 19b35084b..354f61cbb 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 7c595a05d..801109028 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 fa754b055..9442943e9 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 1e4b031a9..e7930ca78 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 b570e9e26..3eaecad79 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 0ed5f457a..06d31b398 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 0c4e53568..71e1aa016 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 4442c24e8..3a8087f1a 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 b33b02fff..4026eba9d 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 bcb643435..871617da4 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 9771371aa..8cc76765b 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 3d4ee34be..92cf1c1e7 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 6f5e25d45..9ce869b9c 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 fe13d4742..01a879244 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 1db51a203..53fcd2158 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 034158448..6d9dec170 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 7a633d3a2..3008fbc01 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 3ff94e87b..a770c2b32 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 25068be12..fce71f4e7 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 d59406b1f..811918076 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 fb36b0a84..494585889 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 d0d0318ff..985de3f66 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 e9e4491c2..d6cd58a21 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 9589759d6..021cce647 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 7059d89e7..8e10b48d8 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 46355cc97..5181438c1 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 7b5ed4f1f..f5762fce1 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 ffba0e5f2..38321f5cb 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 7e0785610..107e1bb3b 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 18aca57a7..ad5ba37e7 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 f8bc9c89e..0fee3f75f 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 5a4d8ba8f..a8cbb9597 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 c5ed4c7f8..ce85370f1 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 66fd9e76a..11a862f44 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 2bc1d446f..958f3df9e 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 9d55b45a5..695fcc180 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]