]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Fix double free of captured owned parameters in async methods
authorJürg Billeter <j@bitron.ch>
Wed, 15 Aug 2012 08:32:36 +0000 (10:32 +0200)
committerJürg Billeter <j@bitron.ch>
Wed, 15 Aug 2012 08:45:00 +0000 (10:45 +0200)
codegen/valagasyncmodule.vala

index 05d1e422bbbcb0504d925dd316bc57cb62bd03ca..eaa3979a38a42095fe0bdcac64d14da66e825e78 100644 (file)
@@ -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;
                                }
                        }
                }