[vala] Fix memory management of closures in async methods
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vala] Fix memory management of closures in async methods
- Date: Mon, 21 Sep 2009 18:02:59 +0000 (UTC)
commit aa2c883416e4b5fcd446263151399e3907871928
Author: Jürg Billeter <j bitron ch>
Date: Mon Sep 21 20:02:05 2009 +0200
Fix memory management of closures in async methods
codegen/valaccodebasemodule.vala | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 1a71181..5fa12f0 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -1675,10 +1675,20 @@ internal class Vala.CCodeBaseModule : CCodeModule {
}
if (requires_destroy (local.variable_type)) {
+ bool old_coroutine = false;
+ if (current_method != null) {
+ old_coroutine = current_method.coroutine;
+ current_method.coroutine = false;
+ }
+
var ma = new MemberAccess.simple (local.name);
ma.symbol_reference = local;
ma.value_type = local.variable_type.copy ();
free_block.add_statement (new CCodeExpressionStatement (get_unref_expression (new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data%d_".printf (block_id)), get_variable_cname (local.name)), local.variable_type, ma)));
+
+ if (old_coroutine) {
+ current_method.coroutine = true;
+ }
}
}
}
@@ -1756,10 +1766,20 @@ internal class Vala.CCodeBaseModule : CCodeModule {
}
if (requires_destroy (param_type) && !is_unowned_delegate) {
+ bool old_coroutine = false;
+ if (current_method != null) {
+ old_coroutine = current_method.coroutine;
+ current_method.coroutine = false;
+ }
+
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
ma.value_type = param_type.copy ();
free_block.add_statement (new CCodeExpressionStatement (get_unref_expression (new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data%d_".printf (block_id)), get_variable_cname (param.name)), param.parameter_type, ma)));
+
+ if (old_coroutine) {
+ current_method.coroutine = true;
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]