summaryrefslogtreecommitdiff
path: root/codegen/valagasyncmodule.vala
diff options
context:
space:
mode:
authorRichard Wiedenhöft <richard@wiedenhoeft.xyz>2016-02-28 18:19:29 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2016-11-07 14:34:01 +0100
commit14cb50afc5e840d0f74f866571df2670d1a3958a (patch)
tree7783f888fc41d180752439288bbca63b00002384 /codegen/valagasyncmodule.vala
parentf56ac63b6c6d3e9238cb1bb11e0ae726bbaf6434 (diff)
downloadvala-14cb50afc5e840d0f74f866571df2670d1a3958a.tar.gz
Fix broken destruction of null-terminated arrays in async data structs
https://bugzilla.gnome.org/show_bug.cgi?id=762819
Diffstat (limited to 'codegen/valagasyncmodule.vala')
-rw-r--r--codegen/valagasyncmodule.vala12
1 files changed, 9 insertions, 3 deletions
diff --git a/codegen/valagasyncmodule.vala b/codegen/valagasyncmodule.vala
index 928e67b66..0ab4336d6 100644
--- a/codegen/valagasyncmodule.vala
+++ b/codegen/valagasyncmodule.vala
@@ -123,9 +123,15 @@ public class Vala.GAsyncModule : GtkModule {
}
if (requires_destroy (m.return_type)) {
- /* this is very evil. */
- var v = new LocalVariable (m.return_type, ".result");
- ccode.add_expression (destroy_local (v));
+ if (get_ccode_array_length (m) || !(m.return_type is ArrayType)) {
+ /* this is very evil. */
+ var v = new LocalVariable (m.return_type, ".result");
+ ccode.add_expression (destroy_local (v));
+ } else {
+ var v = new GLibValue (m.return_type, new CCodeIdentifier ("_data_->result"), true);
+ v.array_null_terminated = get_ccode_array_null_terminated (m);
+ ccode.add_expression (destroy_value (v));
+ }
}
if (m.binding == MemberBinding.INSTANCE) {