]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girwriter: Support transfer-ownership="container" for arrays
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 26 Feb 2019 13:10:35 +0000 (14:10 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 26 Feb 2019 13:12:47 +0000 (14:12 +0100)
codegen/valagirwriter.vala

index c019121675ceedffbe40a5cd71393d7fe66ed030..a1a82cd7b48ef9dc6ce9cd5322cfe875c49425e7 100644 (file)
@@ -1239,7 +1239,8 @@ public class Vala.GIRWriter : CodeVisitor {
                        buffer.append_printf (" direction=\"out\"");
                }
 
-               DelegateType delegate_type = type as DelegateType;
+               unowned DelegateType? delegate_type = type as DelegateType;
+               unowned ArrayType? array_type = type as ArrayType;
 
                if (type != null && ((type.value_owned && delegate_type == null) || (constructor && !type.data_type.is_subtype_of (ginitiallyunowned_type)))) {
                        var any_owned = false;
@@ -1248,6 +1249,8 @@ public class Vala.GIRWriter : CodeVisitor {
                        }
                        if (type.has_type_arguments () && !any_owned) {
                                buffer.append_printf (" transfer-ownership=\"container\"");
+                       } else if (array_type != null && !array_type.element_type.value_owned) {
+                               buffer.append_printf (" transfer-ownership=\"container\"");
                        } else {
                                buffer.append_printf (" transfer-ownership=\"full\"");
                        }