]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix crash and temporary variable declarations when using struct
authorJürg Billeter <j@bitron.ch>
Tue, 16 Dec 2008 19:43:47 +0000 (19:43 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Tue, 16 Dec 2008 19:43:47 +0000 (19:43 +0000)
2008-12-16  Jürg Billeter  <j@bitron.ch>

* vala/valafield.vala:
* gobject/valaccodebasemodule.vala:

Fix crash and temporary variable declarations when using struct
initialization methods in field initializer, fixes bug 559459

svn path=/trunk/; revision=2184

ChangeLog
gobject/valaccodebasemodule.vala
vala/valafield.vala

index 5b1b5745789300189156d430040c5d8ef2ee5032..8515a6526a37a03fe58ffead78fd09a15c1e4bb3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-12-16  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valafield.vala:
+       * gobject/valaccodebasemodule.vala:
+
+       Fix crash and temporary variable declarations when using struct
+       initialization methods in field initializer, fixes bug 559459
+
 2008-12-16  Jürg Billeter  <j@bitron.ch>
 
        * vapigen/valagidlparser.vala:
index 43597cc9f4aff3a2ff069cb2c4d6ee78b512190f..691fdcb08395c453719cb23af087f657118db2a4 100644 (file)
@@ -893,6 +893,9 @@ public class Vala.CCodeBaseModule : CCodeModule {
                                                instance_init_fragment.append (new CCodeExpressionStatement (new CCodeAssignment (array_len_lhs, (CCodeExpression) size.ccodenode)));
                                        }
                                }
+
+                               append_temp_decl (instance_init_fragment, temp_vars);
+                               temp_vars.clear ();
                        }
                        
                        if (requires_destroy (f.field_type) && instance_finalize_fragment != null) {
index 56ec66b2d17c4dbdedcc4549b6589873ba706cf1..6c4872b276cf6905a746846a469e3a7bdc8ba55c 100644 (file)
@@ -173,6 +173,12 @@ public class Vala.Field : Member, Lockable {
                lock_used = used;
        }
 
+       public override void replace_expression (Expression old_node, Expression new_node) {
+               if (initializer == old_node) {
+                       initializer = new_node;
+               }
+       }
+
        public override void replace_type (DataType old_type, DataType new_type) {
                if (field_type == old_type) {
                        field_type = new_type;