[vala/0.30] girparser: Do not unconditionally make a delegate owned



commit 69d3f130b094907ca8decc9c1cb07f44f73e2c43
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Jan 31 21:39:26 2016 +0100

    girparser: Do not unconditionally make a delegate owned
    
    Actually check if there are closure and destroy arguments available.
    
    (cherry picked from commit c2eecf463991304dfec6595afd2584c2efca8e0a)

 vala/valagirparser.vala |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 46cdc77..9c27259 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);
+                               }
                        }
                }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]