From: Rico Tzschichholz Date: Sun, 31 Jan 2016 20:39:26 +0000 (+0100) Subject: girparser: Do not unconditionally make a delegate owned X-Git-Tag: 0.30.2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69d3f130b094907ca8decc9c1cb07f44f73e2c43;p=thirdparty%2Fvala.git girparser: Do not unconditionally make a delegate owned Actually check if there are closure and destroy arguments available. (cherry picked from commit c2eecf463991304dfec6595afd2584c2efca8e0a) --- diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala index 46cdc7791..9c2725918 100644 --- a/vala/valagirparser.vala +++ b/vala/valagirparser.vala @@ -3708,9 +3708,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); + } } }