]> 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 16:53:42 +0000 (17:53 +0100)
codegen/valagirwriter.vala

index 6a6a7d6f82cfd1ea5f4e092c7a0a61b78bbc9388..98758e2fe50b503161bb383c7d45a10bfbf540e7 100644 (file)
@@ -1240,7 +1240,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;
@@ -1249,6 +1250,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\"");
                        }