[vala] Free temporary variables used in instance field initializers



commit 247b585f2405768477b7f121f2c9f6ed3e1ca267
Author: Jürg Billeter <j bitron ch>
Date:   Sun Sep 27 18:27:35 2009 +0200

    Free temporary variables used in instance field initializers

 codegen/valaccodebasemodule.vala |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index ed1eb38..50fd405 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -1030,7 +1030,16 @@ internal class Vala.CCodeBaseModule : CCodeModule {
 				}
 
 				append_temp_decl (instance_init_fragment, temp_vars);
+
+				foreach (LocalVariable local in temp_ref_vars) {
+					var ma = new MemberAccess.simple (local.name);
+					ma.symbol_reference = local;
+					ma.value_type = local.variable_type.copy ();
+					instance_init_fragment.append (new CCodeExpressionStatement (get_unref_expression (get_variable_cexpression (local.name), local.variable_type, ma)));
+				}
+
 				temp_vars.clear ();
+				temp_ref_vars.clear ();
 			}
 			
 			if (requires_destroy (f.field_type) && instance_finalize_fragment != null) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]