]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Fix ownership inheritance of "unowned var" in foreach statement
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 6 Mar 2021 08:46:32 +0000 (09:46 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 6 Mar 2021 09:05:31 +0000 (10:05 +0100)
vala/valaforeachstatement.vala

index 7f77cdc33427c5c7db49876fe44d16e12f030135..bea6c4e9360cd67167bbaeb927cb60eb2c123c03 100644 (file)
@@ -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)) {