]> 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>
Sun, 31 Jan 2016 20:39:26 +0000 (21:39 +0100)
Actually check if there are closure and destroy arguments available.

vala/valagirparser.vala

index a9c994a2da6a531671a32769b940a2b638f614af..e900c6198b9f1add9569705c39ba71d012345f38 100644 (file)
@@ -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);
+                               }
                        }
                }