diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-03-06 09:46:32 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-03-06 10:05:31 +0100 |
commit | e7b08a38dac95bd74c79a6e579edae1004e0bef7 (patch) | |
tree | 4183625b7dbfb4d101d0d2885e6aabef74901995 /vala/valaforeachstatement.vala | |
parent | 328faa8e402b8f4b6abbc7099929c3e1442336b2 (diff) | |
download | vala-e7b08a38dac95bd74c79a6e579edae1004e0bef7.tar.gz |
vala: Fix ownership inheritance of "unowned var" in foreach statement
Diffstat (limited to 'vala/valaforeachstatement.vala')
-rw-r--r-- | vala/valaforeachstatement.vala | 6 |
1 files changed, 4 insertions, 2 deletions
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)) { |