From: Rico Tzschichholz Date: Tue, 26 Feb 2019 13:10:35 +0000 (+0100) Subject: girwriter: Support transfer-ownership="container" for arrays X-Git-Tag: 0.36.18~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f194fe0163bb2ec3fdc7bd26eddb440d336f54bc;p=thirdparty%2Fvala.git girwriter: Support transfer-ownership="container" for arrays --- diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala index 7caeae0c4..6e073541a 100644 --- a/codegen/valagirwriter.vala +++ b/codegen/valagirwriter.vala @@ -1237,7 +1237,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; @@ -1246,6 +1247,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\""); }