GNOME Bugzilla – Bug 621542
Async delegates missing args on dispatch
Last modified: 2010-06-15 09:32:33 UTC
Created attachment 163580 [details] Vala sample illustrating the issue I am attaching a program that generates bad C. The basic architecture is the DBus API defined as an interface, and then an implementing class that dispatches work to an async delegate. This is with Vala 0.8.0. I'll test with 0.9.1 in a sec. Terminal session: $ valac --pkg gio-2.0 --pkg dbus-glib-1 foo.vala ** (valac:16525): CRITICAL **: vala_ccode_expression_statement_construct: assertion `expr != NULL' failed ** (valac:16525): CRITICAL **: vala_ccode_fragment_append: assertion `node != NULL' failed /home/kamstrup/Canonical/unity-place-files/unity-place-files.sections/foo.vala.c: In function ‘_dbus_foo_service_get_value’: /home/kamstrup/Canonical/unity-place-files/unity-place-files.sections/foo.vala.c:244: warning: passing argument 3 of ‘foo_service_get_value’ from incompatible pointer type /home/kamstrup/Canonical/unity-place-files/unity-place-files.sections/foo.vala.c:155: note: expected ‘GAsyncReadyCallback’ but argument is of type ‘void (*)(struct GObject *, struct GAsyncResult *, void **)’ /home/kamstrup/Canonical/unity-place-files/unity-place-files.sections/foo.vala.c: In function ‘_dbus_foo_service_get_value_ready’: /home/kamstrup/Canonical/unity-place-files/unity-place-files.sections/foo.vala.c:261: warning: passing argument 1 of ‘foo_service_get_value_finish’ from incompatible pointer type /home/kamstrup/Canonical/unity-place-files/unity-place-files.sections/foo.vala.c:160: note: expected ‘struct FooService *’ but argument is of type ‘struct GObject *’ /home/kamstrup/Canonical/unity-place-files/unity-place-files.sections/foo.vala.c: In function ‘_foo_service_impl_default_uint_getter_foo_uint_getter’: /home/kamstrup/Canonical/unity-place-files/unity-place-files.sections/foo.vala.c:646: error: too few arguments to function ‘foo_service_impl_default_uint_getter’ error: cc exited with status 256 Compilation failed: 1 error(s), 0 warning(s)
I get the exact same output with Vala 0.9.1
Created attachment 163591 [details] Simpler example, without DBus Digging through the generated C code I can see most of the output above is simply casting warnings (mssing casts to GAsyncReadyCallback and FooService* etc). The final error can be reproduced with non-DBus as well, as can be done with the simplified attached example. The problem is that the async delegate is invoked with args as though it was a normal non-async method.
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of bug 604827 ***