From: Rico Tzschichholz Date: Sat, 6 Mar 2021 08:46:32 +0000 (+0100) Subject: vala: Fix ownership inheritance of "unowned var" in foreach statement X-Git-Tag: 0.51.90~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7b08a38dac95bd74c79a6e579edae1004e0bef7;p=thirdparty%2Fvala.git vala: Fix ownership inheritance of "unowned var" in foreach statement --- diff --git a/vala/valaforeachstatement.vala b/vala/valaforeachstatement.vala index 7f77cdc33..bea6c4e93 100644 --- a/vala/valaforeachstatement.vala +++ b/vala/valaforeachstatement.vala @@ -336,9 +336,10 @@ public class Vala.ForeachStatement : Block { // analyze element type if (type_reference is VarType) { // var type + bool value_owned = type_reference.value_owned; type_reference = element_type.copy (); // FIXME Only follows "unowned var" otherwise inherit ownership of element-type - if (!type_reference.value_owned) { + if (!value_owned) { type_reference.value_owned = false; } } else if (!element_type.compatible (type_reference)) { @@ -358,9 +359,10 @@ public class Vala.ForeachStatement : Block { // analyze element type if (type_reference is VarType) { // var type + bool value_owned = type_reference.value_owned; type_reference = element_type.copy (); // FIXME Only follows "unowned var" otherwise inherit ownership of element-type - if (!type_reference.value_owned) { + if (!value_owned) { type_reference.value_owned = false; } } else if (!element_type.compatible (type_reference)) {