[vala] dova: Fix memory handling of elements in list, set, and map literals
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] dova: Fix memory handling of elements in list, set, and map literals
- Date: Sat, 10 Jul 2010 15:27:00 +0000 (UTC)
commit 905ef386be3e35502f7a78e2a823e95f9702af67
Author: Jürg Billeter <j bitron ch>
Date: Sat Jul 10 17:04:10 2010 +0200
dova: Fix memory handling of elements in list, set, and map literals
Fixes bug 624036.
vala/valalistliteral.vala | 3 +++
vala/valamapliteral.vala | 6 ++++++
vala/valasetliteral.vala | 3 +++
3 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/vala/valalistliteral.vala b/vala/valalistliteral.vala
index b5012c4..bee7431 100644
--- a/vala/valalistliteral.vala
+++ b/vala/valalistliteral.vala
@@ -91,6 +91,7 @@ public class Vala.ListLiteral : Literal {
bool fixed_element_type = false;
if (target_type != null && target_type.data_type == list_type.data_type && target_type.get_type_arguments ().size == 1) {
element_type = target_type.get_type_arguments ().get (0).copy ();
+ element_type.value_owned = false;
fixed_element_type = true;
}
@@ -103,9 +104,11 @@ public class Vala.ListLiteral : Literal {
}
if (element_type == null) {
element_type = expr.value_type.copy ();
+ element_type.value_owned = false;
}
}
+ element_type = element_type.copy ();
element_type.value_owned = true;
list_type.add_type_argument (element_type);
value_type = list_type;
diff --git a/vala/valamapliteral.vala b/vala/valamapliteral.vala
index 054babb..677a5db 100644
--- a/vala/valamapliteral.vala
+++ b/vala/valamapliteral.vala
@@ -90,7 +90,9 @@ public class Vala.MapLiteral : Literal {
bool fixed_element_type = false;
if (target_type != null && target_type.data_type == map_type.data_type && target_type.get_type_arguments ().size == 2) {
map_key_type = target_type.get_type_arguments ().get (0).copy ();
+ map_key_type.value_owned = false;
map_value_type = target_type.get_type_arguments ().get (1).copy ();
+ map_value_type.value_owned = false;
fixed_element_type = true;
}
@@ -107,11 +109,15 @@ public class Vala.MapLiteral : Literal {
}
if (map_key_type == null) {
map_key_type = keys[i].value_type.copy ();
+ map_key_type.value_owned = false;
map_value_type = values[i].value_type.copy ();
+ map_value_type.value_owned = false;
}
}
+ map_key_type = map_key_type.copy ();
map_key_type.value_owned = true;
+ map_value_type = map_value_type.copy ();
map_value_type.value_owned = true;
map_type.add_type_argument (map_key_type);
map_type.add_type_argument (map_value_type);
diff --git a/vala/valasetliteral.vala b/vala/valasetliteral.vala
index 6a6cc41..fdbb44f 100644
--- a/vala/valasetliteral.vala
+++ b/vala/valasetliteral.vala
@@ -75,6 +75,7 @@ public class Vala.SetLiteral : Literal {
bool fixed_element_type = false;
if (target_type != null && target_type.data_type == set_type.data_type && target_type.get_type_arguments ().size == 1) {
element_type = target_type.get_type_arguments ().get (0).copy ();
+ element_type.value_owned = false;
fixed_element_type = true;
}
@@ -87,9 +88,11 @@ public class Vala.SetLiteral : Literal {
}
if (element_type == null) {
element_type = expr.value_type.copy ();
+ element_type.value_owned = false;
}
}
+ element_type = element_type.copy ();
element_type.value_owned = true;
set_type.add_type_argument (element_type);
value_type = set_type;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]