]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Do not unconditionally make a delegate owned
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 31 Jan 2016 20:39:26 +0000 (21:39 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 20 Feb 2016 13:43:55 +0000 (14:43 +0100)
Actually check if there are closure and destroy arguments available.

(cherry picked from commit c2eecf463991304dfec6595afd2584c2efca8e0a)

vala/valagirparser.vala

index 46cdc779186a6fba8b251a6843233a908ca897e6..9c27259183e3ed59a4607788752dcaaced3ea066 100644 (file)
@@ -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);
+                               }
                        }
                }