[vala/staging: 2/2] codegen: Initialize type parameter properties for generics earlier




commit 19135db540936e9f278d60cb8249a04c677ecd9c
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Dec 14 09:04:48 2021 +0100

    codegen: Initialize type parameter properties for generics earlier
    
    If g_object_new() is used then additionally initialize type parameter
    properties with it.
    
    Fixes https://gitlab.gnome.org/GNOME/vala/issues/67

 codegen/valaccodemethodcallmodule.vala             |  17 +-
 tests/Makefile.am                                  |   1 +
 tests/generics/bug640330.c-expected                |   2 +-
 tests/generics/bug694765-2.c-expected              |   4 +-
 tests/generics/constructor-chain-up.c-expected     |   2 +-
 tests/generics/member-dup-destroy.c-expected       |   2 +-
 tests/generics/property-gobject-set.c-expected     | 296 +++++++++++++++++++++
 tests/generics/property-gobject-set.vala           |  18 ++
 .../generics/type-parameter-properties.c-expected  |   2 +-
 .../type-parameter-property-clash.c-expected       |   2 +-
 tests/objects/bug644938.c-expected                 |   2 +-
 tests/objects/bug654702.c-expected                 |   2 +-
 tests/objects/bug667668.c-expected                 |   2 +-
 tests/objects/interface-generics.c-expected        |   2 +-
 tests/objects/signals-generic-return.c-expected    |   2 +-
 15 files changed, 343 insertions(+), 13 deletions(-)
---
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 94c31007b..894660c88 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -160,6 +160,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                        }
 
                        if (!current_class.is_compact) {
+                               int type_param_index = 0;
                                if (current_class != m.parent_symbol) {
                                        // chain up to base class
                                        foreach (DataType base_type in current_class.get_base_types ()) {
@@ -168,6 +169,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                                        if (get_ccode_real_name (m) == "g_object_new") {
                                                                // gobject-style chainup
                                                                type_parameters = ((Class) 
base_type.type_symbol).get_type_parameters ();
+                                                               type_param_index += type_parameters.size;
                                                        }
                                                        add_generic_type_arguments (m, in_arg_map, 
base_type.get_type_arguments (), expr, true, type_parameters);
                                                        break;
@@ -175,7 +177,6 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                        }
                                } else {
                                        // chain up to other constructor in same class
-                                       int type_param_index = 0;
                                        var cl = (Class) m.parent_symbol;
                                        foreach (TypeParameter type_param in cl.get_type_parameters ()) {
                                                in_arg_map.set (get_param_pos (0.1 * type_param_index + 
0.01), new CCodeIdentifier (get_ccode_type_id (type_param)));
@@ -184,6 +185,19 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                                type_param_index++;
                                        }
                                }
+                               if (current_class.has_type_parameters () && get_ccode_real_name (m) == 
"g_object_new") {
+                                       // gobject-style construction
+                                       foreach (var type_param in current_class.get_type_parameters ()) {
+                                               var type_param_name = type_param.name.ascii_down ().replace 
("_", "-");
+                                               in_arg_map.set (get_param_pos (0.1 * type_param_index + 
0.01), new CCodeConstant ("\"%s-type\"".printf (type_param_name)));
+                                               in_arg_map.set (get_param_pos (0.1 * type_param_index + 
0.02), new CCodeIdentifier (get_ccode_type_id (type_param)));
+                                               in_arg_map.set (get_param_pos (0.1 * type_param_index + 
0.03), new CCodeConstant ("\"%s-dup-func\"".printf (type_param_name)));
+                                               in_arg_map.set (get_param_pos (0.1 * type_param_index + 
0.04), new CCodeIdentifier (get_ccode_copy_function (type_param)));
+                                               in_arg_map.set (get_param_pos (0.1 * type_param_index + 
0.05), new CCodeConstant ("\"%s-destroy-func\"".printf (type_param_name)));
+                                               in_arg_map.set (get_param_pos (0.1 * type_param_index + 
0.06), new CCodeIdentifier (get_ccode_destroy_function (type_param)));
+                                               type_param_index++;
+                                       }
+                               }
                        } else if (current_class.is_subtype_of (gsource_type)) {
                                // g_source_new
 
@@ -361,6 +375,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression 
("_data%d_".printf (get_block_id (current_method.body))), "self"), ref_call);
                        }
 
+                       //FIXME Only needed for non-"g_object_new" calls, if there is no property clash
                        if (!current_class.is_compact && current_class.has_type_parameters ()) {
                                /* type, dup func, and destroy func fields for generic types */
                                var priv_access = new CCodeMemberAccess.pointer (new CCodeIdentifier 
("self"), "priv");
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4042d989f..5a5b7a346 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -745,6 +745,7 @@ TESTS = \
        generics/parameter-sizeof-initializer.vala \
        generics/member-dup-destroy.vala \
        generics/null-type.vala \
+       generics/property-gobject-set.vala \
        generics/property-int-cast.vala \
        generics/reference-transfer.vala \
        generics/string-literal-comparison.vala \
diff --git a/tests/generics/bug640330.c-expected b/tests/generics/bug640330.c-expected
index 58433fd45..65c9308ef 100644
--- a/tests/generics/bug640330.c-expected
+++ b/tests/generics/bug640330.c-expected
@@ -178,7 +178,7 @@ bar_construct (GType object_type,
                GDestroyNotify g_destroy_func)
 {
        Bar * self = NULL;
-       self = (Bar*) g_object_new (object_type, NULL);
+       self = (Bar*) g_object_new (object_type, "g-type", g_type, "g-dup-func", g_dup_func, 
"g-destroy-func", g_destroy_func, NULL);
        self->priv->g_type = g_type;
        self->priv->g_dup_func = g_dup_func;
        self->priv->g_destroy_func = g_destroy_func;
diff --git a/tests/generics/bug694765-2.c-expected b/tests/generics/bug694765-2.c-expected
index d34ab0318..1c43c8932 100644
--- a/tests/generics/bug694765-2.c-expected
+++ b/tests/generics/bug694765-2.c-expected
@@ -250,7 +250,7 @@ bar_construct (GType object_type,
                GDestroyNotify g_destroy_func)
 {
        Bar * self = NULL;
-       self = (Bar*) g_object_new (object_type, NULL);
+       self = (Bar*) g_object_new (object_type, "g-type", g_type, "g-dup-func", g_dup_func, 
"g-destroy-func", g_destroy_func, NULL);
        self->priv->g_type = g_type;
        self->priv->g_dup_func = g_dup_func;
        self->priv->g_destroy_func = g_destroy_func;
@@ -423,7 +423,7 @@ baz_construct (GType object_type,
                GDestroyNotify g_destroy_func)
 {
        Baz * self = NULL;
-       self = (Baz*) g_object_new (object_type, NULL);
+       self = (Baz*) g_object_new (object_type, "g-type", g_type, "g-dup-func", g_dup_func, 
"g-destroy-func", g_destroy_func, NULL);
        self->priv->g_type = g_type;
        self->priv->g_dup_func = g_dup_func;
        self->priv->g_destroy_func = g_destroy_func;
diff --git a/tests/generics/constructor-chain-up.c-expected b/tests/generics/constructor-chain-up.c-expected
index c6a309523..ef59fb1a7 100644
--- a/tests/generics/constructor-chain-up.c-expected
+++ b/tests/generics/constructor-chain-up.c-expected
@@ -94,7 +94,7 @@ foo_construct (GType object_type,
                GDestroyNotify g_destroy_func)
 {
        Foo * self = NULL;
-       self = (Foo*) g_object_new (object_type, NULL);
+       self = (Foo*) g_object_new (object_type, "g-type", g_type, "g-dup-func", g_dup_func, 
"g-destroy-func", g_destroy_func, NULL);
        self->priv->g_type = g_type;
        self->priv->g_dup_func = g_dup_func;
        self->priv->g_destroy_func = g_destroy_func;
diff --git a/tests/generics/member-dup-destroy.c-expected b/tests/generics/member-dup-destroy.c-expected
index 23a8fe41b..a6c85b476 100644
--- a/tests/generics/member-dup-destroy.c-expected
+++ b/tests/generics/member-dup-destroy.c-expected
@@ -158,7 +158,7 @@ foo_construct (GType object_type,
 {
        Foo * self = NULL;
        gpointer g = NULL;
-       self = (Foo*) g_object_new (object_type, NULL);
+       self = (Foo*) g_object_new (object_type, "g-type", g_type, "g-dup-func", g_dup_func, 
"g-destroy-func", g_destroy_func, NULL);
        self->priv->g_type = g_type;
        self->priv->g_dup_func = g_dup_func;
        self->priv->g_destroy_func = g_destroy_func;
diff --git a/tests/generics/property-gobject-set.c-expected b/tests/generics/property-gobject-set.c-expected
new file mode 100644
index 000000000..c485fcfa8
--- /dev/null
+++ b/tests/generics/property-gobject-set.c-expected
@@ -0,0 +1,296 @@
+/* generics_property_gobject_set.c generated by valac, the Vala compiler
+ * generated from generics_property_gobject_set.vala, do not modify */
+
+#include <glib-object.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define TYPE_FOO (foo_get_type ())
+#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
+#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
+#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
+#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
+#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
+
+typedef struct _Foo Foo;
+typedef struct _FooClass FooClass;
+typedef struct _FooPrivate FooPrivate;
+enum  {
+       FOO_0_PROPERTY,
+       FOO_G_TYPE,
+       FOO_G_DUP_FUNC,
+       FOO_G_DESTROY_FUNC,
+       FOO_G_DATA_PROPERTY,
+       FOO_NUM_PROPERTIES
+};
+static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, 
G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning 
(G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, 
__LINE__, G_STRFUNC, msg);
+
+struct _Foo {
+       GObject parent_instance;
+       FooPrivate * priv;
+};
+
+struct _FooClass {
+       GObjectClass parent_class;
+};
+
+struct _FooPrivate {
+       GType g_type;
+       GBoxedCopyFunc g_dup_func;
+       GDestroyNotify g_destroy_func;
+       gpointer _g_data;
+};
+
+static gint Foo_private_offset;
+static gpointer foo_parent_class = NULL;
+
+VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
+VALA_EXTERN Foo* foo_new (GType g_type,
+              GBoxedCopyFunc g_dup_func,
+              GDestroyNotify g_destroy_func,
+              gconstpointer g_data);
+VALA_EXTERN Foo* foo_construct (GType object_type,
+                    GType g_type,
+                    GBoxedCopyFunc g_dup_func,
+                    GDestroyNotify g_destroy_func,
+                    gconstpointer g_data);
+VALA_EXTERN gconstpointer foo_get_g_data (Foo* self);
+VALA_EXTERN void foo_set_g_data (Foo* self,
+                     gconstpointer value);
+static void foo_finalize (GObject * obj);
+static GType foo_get_type_once (void);
+static void _vala_foo_get_property (GObject * object,
+                             guint property_id,
+                             GValue * value,
+                             GParamSpec * pspec);
+static void _vala_foo_set_property (GObject * object,
+                             guint property_id,
+                             const GValue * value,
+                             GParamSpec * pspec);
+static void _vala_main (void);
+
+static inline gpointer
+foo_get_instance_private (Foo* self)
+{
+       return G_STRUCT_MEMBER_P (self, Foo_private_offset);
+}
+
+Foo*
+foo_construct (GType object_type,
+               GType g_type,
+               GBoxedCopyFunc g_dup_func,
+               GDestroyNotify g_destroy_func,
+               gconstpointer g_data)
+{
+       Foo * self = NULL;
+       self = (Foo*) g_object_new (object_type, "g-type", g_type, "g-dup-func", g_dup_func, 
"g-destroy-func", g_destroy_func, "g-data", g_data, NULL);
+       self->priv->g_type = g_type;
+       self->priv->g_dup_func = g_dup_func;
+       self->priv->g_destroy_func = g_destroy_func;
+       return self;
+}
+
+Foo*
+foo_new (GType g_type,
+         GBoxedCopyFunc g_dup_func,
+         GDestroyNotify g_destroy_func,
+         gconstpointer g_data)
+{
+       return foo_construct (TYPE_FOO, g_type, g_dup_func, g_destroy_func, g_data);
+}
+
+gconstpointer
+foo_get_g_data (Foo* self)
+{
+       gconstpointer result;
+       gconstpointer _tmp0_;
+       g_return_val_if_fail (IS_FOO (self), NULL);
+       _tmp0_ = self->priv->_g_data;
+       result = _tmp0_;
+       return result;
+}
+
+void
+foo_set_g_data (Foo* self,
+                gconstpointer value)
+{
+       gpointer old_value;
+       g_return_if_fail (IS_FOO (self));
+       old_value = foo_get_g_data (self);
+       if (old_value != value) {
+               gpointer _tmp0_;
+               _tmp0_ = ((value != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func 
((gpointer) value) : ((gpointer) value);
+               ((self->priv->_g_data == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : 
(self->priv->_g_data = (self->priv->g_destroy_func (self->priv->_g_data), NULL));
+               self->priv->_g_data = _tmp0_;
+               g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_G_DATA_PROPERTY]);
+       }
+}
+
+static void
+foo_class_init (FooClass * klass,
+                gpointer klass_data)
+{
+       foo_parent_class = g_type_class_peek_parent (klass);
+       g_type_class_adjust_private_offset (klass, &Foo_private_offset);
+       G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property;
+       G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property;
+       G_OBJECT_CLASS (klass)->finalize = foo_finalize;
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_TYPE, g_param_spec_gtype ("g-type", 
"type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_DUP_FUNC, g_param_spec_pointer 
("g-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_DESTROY_FUNC, g_param_spec_pointer 
("g-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | 
G_PARAM_CONSTRUCT_ONLY));
+       g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_G_DATA_PROPERTY, 
foo_properties[FOO_G_DATA_PROPERTY] = g_param_spec_pointer ("g-data", "g-data", "g-data", 
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+static void
+foo_instance_init (Foo * self,
+                   gpointer klass)
+{
+       self->priv = foo_get_instance_private (self);
+}
+
+static void
+foo_finalize (GObject * obj)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
+       ((self->priv->_g_data == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (self->priv->_g_data 
= (self->priv->g_destroy_func (self->priv->_g_data), NULL));
+       G_OBJECT_CLASS (foo_parent_class)->finalize (obj);
+}
+
+static GType
+foo_get_type_once (void)
+{
+       static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, 
(GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, 
(GInstanceInitFunc) foo_instance_init, NULL };
+       GType foo_type_id;
+       foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
+       Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate));
+       return foo_type_id;
+}
+
+GType
+foo_get_type (void)
+{
+       static volatile gsize foo_type_id__volatile = 0;
+       if (g_once_init_enter (&foo_type_id__volatile)) {
+               GType foo_type_id;
+               foo_type_id = foo_get_type_once ();
+               g_once_init_leave (&foo_type_id__volatile, foo_type_id);
+       }
+       return foo_type_id__volatile;
+}
+
+static void
+_vala_foo_get_property (GObject * object,
+                        guint property_id,
+                        GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_G_DATA_PROPERTY:
+               g_value_set_pointer (value, foo_get_g_data (self));
+               break;
+               case FOO_G_TYPE:
+               g_value_set_gtype (value, self->priv->g_type);
+               break;
+               case FOO_G_DUP_FUNC:
+               g_value_set_pointer (value, self->priv->g_dup_func);
+               break;
+               case FOO_G_DESTROY_FUNC:
+               g_value_set_pointer (value, self->priv->g_destroy_func);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_foo_set_property (GObject * object,
+                        guint property_id,
+                        const GValue * value,
+                        GParamSpec * pspec)
+{
+       Foo * self;
+       self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo);
+       switch (property_id) {
+               case FOO_G_DATA_PROPERTY:
+               foo_set_g_data (self, g_value_get_pointer (value));
+               break;
+               case FOO_G_TYPE:
+               self->priv->g_type = g_value_get_gtype (value);
+               break;
+               case FOO_G_DUP_FUNC:
+               self->priv->g_dup_func = g_value_get_pointer (value);
+               break;
+               case FOO_G_DESTROY_FUNC:
+               self->priv->g_destroy_func = g_value_get_pointer (value);
+               break;
+               default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               break;
+       }
+}
+
+static void
+_vala_main (void)
+{
+       {
+               Foo* foo = NULL;
+               GObject* _tmp0_;
+               GObject* _tmp1_;
+               Foo* _tmp2_;
+               Foo* _tmp3_;
+               gconstpointer _tmp4_;
+               gconstpointer _tmp5_;
+               _tmp0_ = g_object_new (G_TYPE_OBJECT, NULL);
+               _tmp1_ = _tmp0_;
+               _tmp2_ = foo_new (G_TYPE_OBJECT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) 
g_object_unref, _tmp1_);
+               _tmp3_ = _tmp2_;
+               _g_object_unref0 (_tmp1_);
+               foo = _tmp3_;
+               _tmp4_ = foo_get_g_data (foo);
+               _tmp5_ = _tmp4_;
+               _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE ((GObject*) _tmp5_, G_TYPE_OBJECT), "foo.g_data is 
Object");
+               _g_object_unref0 (foo);
+       }
+       {
+               Foo* foo = NULL;
+               Foo* _tmp6_;
+               gconstpointer _tmp7_;
+               gconstpointer _tmp8_;
+               _tmp6_ = foo_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, "foo");
+               foo = _tmp6_;
+               _tmp7_ = foo_get_g_data (foo);
+               _tmp8_ = _tmp7_;
+               _vala_assert (g_strcmp0 ((const gchar*) _tmp8_, "foo") == 0, "foo.g_data == \"foo\"");
+               _g_object_unref0 (foo);
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main ();
+       return 0;
+}
+
diff --git a/tests/generics/property-gobject-set.vala b/tests/generics/property-gobject-set.vala
new file mode 100644
index 000000000..e055f54f6
--- /dev/null
+++ b/tests/generics/property-gobject-set.vala
@@ -0,0 +1,18 @@
+class Foo<G> : Object {
+       public G g_data { get; set; }
+
+       public Foo (G g_data) {
+               Object (g_data: g_data);
+       }
+}
+
+void main () {
+       {
+               var foo = new Foo<Object> (new Object ());
+               assert (foo.g_data is Object);
+       }
+       {
+               var foo = new Foo<string> ("foo");
+               assert (foo.g_data == "foo");
+       }
+}
diff --git a/tests/generics/type-parameter-properties.c-expected 
b/tests/generics/type-parameter-properties.c-expected
index 1ae87f241..7d6b6d657 100644
--- a/tests/generics/type-parameter-properties.c-expected
+++ b/tests/generics/type-parameter-properties.c-expected
@@ -145,7 +145,7 @@ foo_construct (GType object_type,
                GDestroyNotify g_destroy_func)
 {
        Foo * self = NULL;
-       self = (Foo*) g_object_new (object_type, NULL);
+       self = (Foo*) g_object_new (object_type, "g-type", g_type, "g-dup-func", g_dup_func, 
"g-destroy-func", g_destroy_func, NULL);
        self->priv->g_type = g_type;
        self->priv->g_dup_func = g_dup_func;
        self->priv->g_destroy_func = g_destroy_func;
diff --git a/tests/generics/type-parameter-property-clash.c-expected 
b/tests/generics/type-parameter-property-clash.c-expected
index f5659405a..d1c8e95e5 100644
--- a/tests/generics/type-parameter-property-clash.c-expected
+++ b/tests/generics/type-parameter-property-clash.c-expected
@@ -149,7 +149,7 @@ foo_construct (GType object_type,
                GDestroyNotify g_destroy_func)
 {
        Foo * self = NULL;
-       self = (Foo*) g_object_new (object_type, NULL);
+       self = (Foo*) g_object_new (object_type, "g-type", g_type, "g-dup-func", g_dup_func, 
"g-destroy-func", g_destroy_func, NULL);
        self->priv->g_type = g_type;
        self->priv->g_dup_func = g_dup_func;
        self->priv->g_destroy_func = g_destroy_func;
diff --git a/tests/objects/bug644938.c-expected b/tests/objects/bug644938.c-expected
index cbbd915c8..b39f3bb7e 100644
--- a/tests/objects/bug644938.c-expected
+++ b/tests/objects/bug644938.c-expected
@@ -140,7 +140,7 @@ foo_construct (GType object_type,
                GDestroyNotify type_param_destroy_func)
 {
        Foo * self = NULL;
-       self = (Foo*) g_object_new (object_type, NULL);
+       self = (Foo*) g_object_new (object_type, "type-param-type", type_param_type, "type-param-dup-func", 
type_param_dup_func, "type-param-destroy-func", type_param_destroy_func, NULL);
        self->priv->type_param_type = type_param_type;
        self->priv->type_param_dup_func = type_param_dup_func;
        self->priv->type_param_destroy_func = type_param_destroy_func;
diff --git a/tests/objects/bug654702.c-expected b/tests/objects/bug654702.c-expected
index 90effd29b..12c0dcfd5 100644
--- a/tests/objects/bug654702.c-expected
+++ b/tests/objects/bug654702.c-expected
@@ -118,7 +118,7 @@ foo_construct (GType object_type,
                GDestroyNotify t_destroy_func)
 {
        Foo * self = NULL;
-       self = (Foo*) g_object_new (object_type, NULL);
+       self = (Foo*) g_object_new (object_type, "t-type", t_type, "t-dup-func", t_dup_func, 
"t-destroy-func", t_destroy_func, NULL);
        self->priv->t_type = t_type;
        self->priv->t_dup_func = t_dup_func;
        self->priv->t_destroy_func = t_destroy_func;
diff --git a/tests/objects/bug667668.c-expected b/tests/objects/bug667668.c-expected
index a2a70c2dd..1f9ff83bf 100644
--- a/tests/objects/bug667668.c-expected
+++ b/tests/objects/bug667668.c-expected
@@ -141,7 +141,7 @@ foo_construct (GType object_type,
                GDestroyNotify g_destroy_func)
 {
        Foo * self = NULL;
-       self = (Foo*) g_object_new (object_type, NULL);
+       self = (Foo*) g_object_new (object_type, "g-type", g_type, "g-dup-func", g_dup_func, 
"g-destroy-func", g_destroy_func, NULL);
        self->priv->g_type = g_type;
        self->priv->g_dup_func = g_dup_func;
        self->priv->g_destroy_func = g_destroy_func;
diff --git a/tests/objects/interface-generics.c-expected b/tests/objects/interface-generics.c-expected
index bbff3c659..92bfba197 100644
--- a/tests/objects/interface-generics.c-expected
+++ b/tests/objects/interface-generics.c-expected
@@ -152,7 +152,7 @@ foo_construct (GType object_type,
                GDestroyNotify g_destroy_func)
 {
        Foo * self = NULL;
-       self = (Foo*) g_object_new (object_type, NULL);
+       self = (Foo*) g_object_new (object_type, "g-type", g_type, "g-dup-func", g_dup_func, 
"g-destroy-func", g_destroy_func, NULL);
        self->priv->g_type = g_type;
        self->priv->g_dup_func = g_dup_func;
        self->priv->g_destroy_func = g_destroy_func;
diff --git a/tests/objects/signals-generic-return.c-expected b/tests/objects/signals-generic-return.c-expected
index c2170c71a..ed3b2c67c 100644
--- a/tests/objects/signals-generic-return.c-expected
+++ b/tests/objects/signals-generic-return.c-expected
@@ -131,7 +131,7 @@ foo_construct (GType object_type,
                GDestroyNotify t_destroy_func)
 {
        Foo * self = NULL;
-       self = (Foo*) g_object_new (object_type, NULL);
+       self = (Foo*) g_object_new (object_type, "g-type", g_type, "g-dup-func", g_dup_func, 
"g-destroy-func", g_destroy_func, "t-type", t_type, "t-dup-func", t_dup_func, "t-destroy-func", 
t_destroy_func, NULL);
        self->priv->g_type = g_type;
        self->priv->g_dup_func = g_dup_func;
        self->priv->g_destroy_func = g_destroy_func;


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