]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Fix access to captured generics in async method of interfaces (2)
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 18 Apr 2021 19:02:21 +0000 (21:02 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 28 Apr 2021 06:47:37 +0000 (08:47 +0200)
See https://gitlab.gnome.org/GNOME/vala/issues/537

codegen/valaccodebasemodule.vala
tests/objects/interface-async-captured-generic.vala

index a702d38a5eafafb4ddc6c1e261a7c52080a13f6e..d746f60506f79acb9c26714485e21046a7f71820 100644 (file)
@@ -2939,9 +2939,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                                string method_name = "get_%s_dup_func".printf (type_parameter.name.ascii_down ());
                                var cast_self = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_type_get_function (iface)));
-                               cast_self.add_argument (new CCodeIdentifier ("self"));
+                               cast_self.add_argument (get_this_cexpression ());
                                var function_call = new CCodeFunctionCall (new CCodeMemberAccess.pointer (cast_self, method_name));
-                               function_call.add_argument (new CCodeIdentifier ("self"));
+                               function_call.add_argument (get_this_cexpression ());
                                return function_call;
                        }
 
index ae51d676af7aaa66b29f0478f46d6100123ce006..7249fb63e193e1e0c18422bb632d8fdd17521830 100644 (file)
@@ -1,8 +1,13 @@
 [GenericAccessors]
 interface IFoo<G> : Object {
-       public async void bar (G g) {
+       public async void bar (owned G g) {
                assert (typeof (G) == typeof (string));
                assert (g == "foo");
+               baz (g);
+       }
+
+       public void baz (owned G g) {
+               assert (g == "foo");
        }
 }