From: Luca Bruno Date: Fri, 10 Jun 2011 11:04:00 +0000 (+0200) Subject: GAsync: Fix the definition of async virtual methods in interfaces X-Git-Tag: 0.13.0~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62eaa62957ce424dec6f7de8326526eccf020539;p=thirdparty%2Fvala.git GAsync: Fix the definition of async virtual methods in interfaces Fixes bug 652252. --- diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala index 239f3a38c..2a239df2f 100644 --- a/codegen/valagtypemodule.vala +++ b/codegen/valagtypemodule.vala @@ -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 ())); + } } } diff --git a/tests/Makefile.am b/tests/Makefile.am index bec9a3f30..820f42b92 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 000000000..2d2dbb376 --- /dev/null +++ b/tests/asynchronous/bug652252.vala @@ -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(); +}