]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
GIRWriter: Properly emit transfer-ownership=container
authorMichal Hruby <michal.mhr@gmail.com>
Wed, 5 Jun 2013 23:18:09 +0000 (00:18 +0100)
committerMichal Hruby <michal.mhr@gmail.com>
Wed, 5 Jun 2013 23:18:09 +0000 (00:18 +0100)
codegen/valagirwriter.vala

index 612fafe0552459fc3b6c0565bf8caa135b28e313..6f61af50ddd630107ce53b3ff8c608ae5964993b 100644 (file)
@@ -1191,7 +1191,15 @@ public class Vala.GIRWriter : CodeVisitor {
                DelegateType delegate_type = type as DelegateType;
 
                if ((type.value_owned && delegate_type == null) || (constructor && !type.data_type.is_subtype_of (ginitiallyunowned_type))) {
-                       buffer.append_printf (" transfer-ownership=\"full\"");
+                       var any_owned = false;
+                       foreach (var generic_arg in type.get_type_arguments ()) {
+                               any_owned |= generic_arg.value_owned;
+                       }
+                       if (type.has_type_arguments () && !any_owned) {
+                               buffer.append_printf (" transfer-ownership=\"container\"");
+                       } else {
+                               buffer.append_printf (" transfer-ownership=\"full\"");
+                       }
                } else {
                        buffer.append_printf (" transfer-ownership=\"none\"");
                }