[vala/staging] vala: Fix ownership inheritance of "unowned var" in foreach statement
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] vala: Fix ownership inheritance of "unowned var" in foreach statement
- Date: Sat, 6 Mar 2021 09:07:06 +0000 (UTC)
commit e7b08a38dac95bd74c79a6e579edae1004e0bef7
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Mar 6 09:46:32 2021 +0100
vala: Fix ownership inheritance of "unowned var" in foreach statement
vala/valaforeachstatement.vala | 6 ++++--
1 file 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)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]