[vala] codegen: Fix memory leak in set accessor with owned value
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] codegen: Fix memory leak in set accessor with owned value
- Date: Thu, 9 Jun 2011 11:15:30 +0000 (UTC)
commit 45fa8b6a253d92ff9732d036643b903497f6be78
Author: Luca Bruno <lucabru src gnome org>
Date: Thu Jun 9 13:11:21 2011 +0200
codegen: Fix memory leak in set accessor with owned value
Fixes bug 652181.
codegen/valaccodebasemodule.vala | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 4ffca72..5deaf95 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -1947,6 +1947,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
return_out_parameter (param);
}
}
+ } else if (b.parent_symbol is PropertyAccessor) {
+ var acc = (PropertyAccessor) b.parent_symbol;
+ if (acc.value_parameter != null && !acc.value_parameter.captured && requires_destroy (acc.value_parameter.variable_type)) {
+ ccode.add_expression (destroy_parameter (acc.value_parameter));
+ }
}
if (b.captured) {
@@ -3109,6 +3114,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
append_local_free (sym.parent_symbol, stop_at_loop, stop_at);
} else if (sym.parent_symbol is Method) {
append_param_free ((Method) sym.parent_symbol);
+ } else if (sym.parent_symbol is PropertyAccessor) {
+ var acc = (PropertyAccessor) sym.parent_symbol;
+ if (acc.value_parameter != null && requires_destroy (acc.value_parameter.variable_type)) {
+ ccode.add_expression (destroy_parameter (acc.value_parameter));
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]