[vala] codegen: Fix double free of captured owned parameters in async methods



commit b7c29ee981e0ad8276891d73c96ea57a94a96759
Author: JÃrg Billeter <j bitron ch>
Date:   Wed Aug 15 10:32:36 2012 +0200

    codegen: Fix double free of captured owned parameters in async methods

 codegen/valagasyncmodule.vala |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
---
diff --git a/codegen/valagasyncmodule.vala b/codegen/valagasyncmodule.vala
index 05d1e42..eaa3979 100644
--- a/codegen/valagasyncmodule.vala
+++ b/codegen/valagasyncmodule.vala
@@ -1,6 +1,6 @@
 /* valagasyncmodule.vala
  *
- * Copyright (C) 2008-2010  JÃrg Billeter
+ * Copyright (C) 2008-2012  JÃrg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -110,20 +110,14 @@ public class Vala.GAsyncModule : GSignalModule {
 		ccode.add_declaration (dataname + "*", new CCodeVariableDeclarator ("_data_", new CCodeIdentifier ("_data")));
 
 		foreach (Parameter param in m.get_parameters ()) {
-			if (param.direction != ParameterDirection.OUT) {
+			if (!param.captured && param.direction != ParameterDirection.OUT) {
 				var param_type = param.variable_type.copy ();
 				if (!param_type.value_owned) {
 					param_type.value_owned = !no_implicit_copy (param_type);
 				}
 
 				if (requires_destroy (param_type)) {
-					// do not try to access closure blocks
-					bool old_captured = param.captured;
-					param.captured = false;
-
 					ccode.add_expression (destroy_parameter (param));
-
-					param.captured = old_captured;
 				}
 			}
 		}



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