[vala/0.50] 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/0.50] vala: Fix ownership inheritance of "unowned var" in foreach statement
- Date: Sun, 14 Mar 2021 15:47:53 +0000 (UTC)
commit d8d8ff1ae75b6827cd75393ec285388f705e2ddf
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 465c817bd..d6ef7c2df 100644
--- a/vala/valaforeachstatement.vala
+++ b/vala/valaforeachstatement.vala
@@ -332,9 +332,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)) {
@@ -354,9 +355,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]