inst_ma.target_value = typed_inst;
store_property (p, inst_ma, init.initializer.target_value);
// FIXME Do not ref/copy in the first place
- if (requires_destroy (init.initializer.target_value.value_type)) {
+ if (!p.set_accessor.value_type.value_owned && requires_destroy (init.initializer.target_value.value_type)) {
ccode.add_expression (destroy_value (init.initializer.target_value));
}
}
objects/interface-property-override.vala \
objects/interface-virtual-override.vala \
objects/member-initializer-base-properties.vala \
+ objects/member-initializer-property-owned-setter.vala \
objects/methods.vala \
objects/paramspec.vala \
objects/plugin-module-init.vala \
--- /dev/null
+class Bar : Object {
+}
+
+class Foo : Object {
+ public string[] faz { get; owned set; }
+ public Bar bar { get; owned set; }
+}
+
+void main() {
+ string[] sa = { "foo", "bar" };
+ var o = new Bar ();
+
+ var foo = new Foo () {
+ faz = sa,
+ bar = o
+ };
+
+ assert (foo.faz[1] == "bar");
+ assert (foo.bar.ref_count == 2);
+ assert (sa[0] == "foo");
+ assert (o.ref_count == 2);
+}