[vala] codegen: Fix execution order of finally blocks



commit a8b6929ca8eb5383acd7a1c11c4e2536f300acc0
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date:   Fri Apr 29 11:48:02 2011 +0200

    codegen: Fix execution order of finally blocks
    
    Fixes bug 648807.

 codegen/valaccodebasemodule.vala |    5 +++++
 codegen/valagerrormodule.vala    |    4 +---
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 8e1ca6d..f963c49 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -3271,6 +3271,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 			ccode.add_assignment (get_variable_cexpression ("_data%d_".printf (block_id)), new CCodeConstant ("NULL"));
 		}
 
+		append_scope_free (sym, stop_at);
+
 		if (stop_at_loop) {
 			if (b.parent_node is Loop ||
 			    b.parent_node is ForeachStatement ||
@@ -3290,6 +3292,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		}
 	}
 
+	protected virtual void append_scope_free (Symbol sym, CodeNode? stop_at = null) {
+	}
+
 	private void append_param_free (Method m) {
 		foreach (Parameter param in m.get_parameters ()) {
 			if (!param.ellipsis && requires_destroy (param.variable_type) && param.direction == ParameterDirection.IN) {
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index 75e9a78..157778b 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -361,9 +361,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
 		ccode.close ();
 	}
 
-	public override void append_local_free (Symbol sym, bool stop_at_loop = false, CodeNode? stop_at = null) {
-		base.append_local_free (sym, stop_at_loop, stop_at);
-
+	protected override void append_scope_free (Symbol sym, CodeNode? stop_at = null) {
 		if (!(stop_at is TryStatement || stop_at is CatchClause)) {
 			var finally_block = (Block) null;
 			if (sym.parent_node is TryStatement) {



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