From 95429f6a871ae122a326e46641c069412304fb6b Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Tue, 26 Feb 2019 14:10:35 +0100 Subject: [PATCH] girwriter: Support transfer-ownership="container" for arrays --- codegen/valagirwriter.vala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala index c01912167..a1a82cd7b 100644 --- a/codegen/valagirwriter.vala +++ b/codegen/valagirwriter.vala @@ -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\""); } -- 2.47.2