[vala] GAsync: Fix the definition of async virtual methods in interfaces



commit 62eaa62957ce424dec6f7de8326526eccf020539
Author: Luca Bruno <lucabru src gnome org>
Date:   Fri Jun 10 13:04:00 2011 +0200

    GAsync: Fix the definition of async virtual methods in interfaces
    
    Fixes bug 652252.

 codegen/valagtypemodule.vala      |    3 +++
 tests/Makefile.am                 |    1 +
 tests/asynchronous/bug652252.vala |   16 ++++++++++++++++
 3 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 239f3a3..2a239df 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 bec9a3f..820f42b 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 0000000..2d2dbb3
--- /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();
+}



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