[vala] D-Bus: Fix array freeing in servers
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [vala] D-Bus: Fix array freeing in servers
- Date: Mon, 1 Jun 2009 02:47:39 -0400 (EDT)
commit f92b0c3a357138c7763629a00832f67698dec09e
Author: Jürg Billeter <j bitron ch>
Date: Mon Jun 1 08:46:24 2009 +0200
D-Bus: Fix array freeing in servers
Fixes bug 566207.
---
codegen/valadbusservermodule.vala | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/codegen/valadbusservermodule.vala b/codegen/valadbusservermodule.vala
index 1ffcbda..51154c9 100644
--- a/codegen/valadbusservermodule.vala
+++ b/codegen/valadbusservermodule.vala
@@ -170,8 +170,10 @@ internal class Vala.DBusServerModule : DBusClientModule {
}
if (requires_destroy (owned_type)) {
+ // keep local alive (symbol_reference is weak)
+ var local = new LocalVariable (owned_type, param.name);
var ma = new MemberAccess.simple (param.name);
- ma.symbol_reference = param;
+ ma.symbol_reference = local;
postfragment.append (new CCodeExpressionStatement (get_unref_expression (new CCodeIdentifier (param.name), owned_type, ma)));
}
}
@@ -203,8 +205,12 @@ internal class Vala.DBusServerModule : DBusClientModule {
write_expression (postfragment, m.return_type, new CCodeIdentifier ("iter"), new CCodeIdentifier ("result"));
if (requires_destroy (m.return_type)) {
+ // keep local alive (symbol_reference is weak)
+ // space before `result' is work around to not trigger
+ // variable renaming, we really mean C identifier `result' here
+ var local = new LocalVariable (m.return_type, " result");
var ma = new MemberAccess.simple ("result");
- ma.symbol_reference = new LocalVariable (m.return_type, "result");
+ ma.symbol_reference = local;
postfragment.append (new CCodeExpressionStatement (get_unref_expression (new CCodeIdentifier ("result"), m.return_type, ma)));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]