summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2016-01-31 21:39:26 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2016-01-31 21:39:26 +0100
commitc2eecf463991304dfec6595afd2584c2efca8e0a (patch)
tree6689a5acf3649f5950adc1b5bbc366a35bd9272c
parent27c31f2a08823d0871b615e3b06ec42ff5905f38 (diff)
downloadvala-c2eecf463991304dfec6595afd2584c2efca8e0a.tar.gz
girparser: Do not unconditionally make a delegate owned
Actually check if there are closure and destroy arguments available.
-rw-r--r--vala/valagirparser.vala7
1 files changed, 6 insertions, 1 deletions
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index a9c994a2d..e900c6198 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -3723,9 +3723,14 @@ public class Vala.GirParser : CodeVisitor {
var d = ((DelegateType) resolved_type).delegate_symbol;
if (!(d.name == "DestroyNotify" && d.parent_symbol.name == "GLib")) {
info.param.set_attribute_string ("CCode", "scope", "async");
- info.param.variable_type.value_owned = true;
+ info.param.variable_type.value_owned = (info.closure_idx != -1 && info.destroy_idx != -1);
}
}
+ } else {
+ var resolved_type = info.param.variable_type;
+ if (resolved_type is DelegateType) {
+ info.param.variable_type.value_owned = (info.closure_idx != -1 && info.destroy_idx != -1);
+ }
}
}