]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
GAsync: Fix the definition of async virtual methods in interfaces
authorLuca Bruno <lucabru@src.gnome.org>
Fri, 10 Jun 2011 11:04:00 +0000 (13:04 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Fri, 10 Jun 2011 11:32:22 +0000 (13:32 +0200)
Fixes bug 652252.

codegen/valagtypemodule.vala
tests/Makefile.am
tests/asynchronous/bug652252.vala [new file with mode: 0644]

index 239f3a38c5d369bedc344f1214b8c28c78b0a1a0..2a239df2ff0b70b48eacd933e393de4d1b45e501 100644 (file)
@@ -2040,6 +2040,9 @@ public class Vala.GTypeModule : GErrorModule {
                        if (m.is_virtual) {
                                var cname = m.get_real_cname ();
                                ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, m.vfunc_name), new CCodeIdentifier (cname));
+                               if (m.coroutine) {
+                                       ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, m.get_finish_vfunc_name ()), new CCodeIdentifier (m.get_finish_real_cname ()));
+                               }
                        }
                }
 
index bec9a3f307828dfeb7e5d574be21d7c8ab42f24e..820f42b924bccd3443a83be7093c03e8baecdbb1 100644 (file)
@@ -109,6 +109,7 @@ TESTS = \
        asynchronous/bug639591.vala \
        asynchronous/bug641182.vala \
        asynchronous/bug646945.vala \
+       asynchronous/bug652252.vala \
        asynchronous/closures.vala \
        dbus/basic-types.test \
        dbus/arrays.test \
diff --git a/tests/asynchronous/bug652252.vala b/tests/asynchronous/bug652252.vala
new file mode 100644 (file)
index 0000000..2d2dbb3
--- /dev/null
@@ -0,0 +1,16 @@
+interface Foo : Object {
+       public async virtual void foo () {
+       }
+}
+
+class Bar : Object, Foo {
+}
+
+void main () {
+       var loop = new MainLoop();
+
+       var bar = new Bar ();
+       bar.foo.begin ((s,r) => { bar.foo.end (r); loop.quit (); });
+
+       loop.run();
+}