]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girwriter: Don't add target for delegates without target
authorWill Szumski <will@cowboycoders.org>
Mon, 24 Feb 2014 15:03:24 +0000 (15:03 +0000)
committerLuca Bruno <lucabru@src.gnome.org>
Sun, 2 Mar 2014 21:11:54 +0000 (22:11 +0100)
Fixes bug 725073.

codegen/valagirwriter.vala

index f6da0add6b4b2ab668604e846c863f088988227c..f3d51003ba21fdc098ff2b2781ac12bfef5d8ea2 100644 (file)
@@ -814,12 +814,14 @@ public class Vala.GIRWriter : CodeVisitor {
                        var int_type = new IntegerType (CodeContext.get ().root.scope.lookup ("int") as Struct);
                        write_param_or_return (int_type, true, ref index, has_array_length, "%s_length1".printf (name), null, direction);
                } else if (type is DelegateType) {
-                       var data_type = new PointerType (new VoidType ());
-                       write_param_or_return (data_type, true, ref index, false, "%s_target".printf (name), null, direction);
                        var deleg_type = (DelegateType) type;
-                       if (deleg_type.is_disposable ()) {
-                               var notify_type = new DelegateType (CodeContext.get ().root.scope.lookup ("GLib").scope.lookup ("DestroyNotify") as Delegate);
-                               write_param_or_return (notify_type, true, ref index, false, "%s_target_destroy_notify".printf (name), null, direction);
+                       if (deleg_type.delegate_symbol.has_target) {
+                               var data_type = new PointerType (new VoidType ());
+                               write_param_or_return (data_type, true, ref index, false, "%s_target".printf (name), null, direction);
+                               if (deleg_type.is_disposable ()) {
+                                       var notify_type = new DelegateType (CodeContext.get ().root.scope.lookup ("GLib").scope.lookup ("DestroyNotify") as Delegate);
+                                       write_param_or_return (notify_type, true, ref index, false, "%s_target_destroy_notify".printf (name), null, direction);
+                               }
                        }
                }
        }