]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
GAsync: Fix connecting signal handlers in async methods
authorJürg Billeter <j@bitron.ch>
Fri, 2 Oct 2009 20:11:11 +0000 (22:11 +0200)
committerJürg Billeter <j@bitron.ch>
Fri, 2 Oct 2009 20:11:11 +0000 (22:11 +0200)
Fixes bug 595755.

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

index 2387b127a868a7f8f84d96de2efdd820c522b5f9..8bfcd9ff57253554c4f3ee8ecc5256e4806ecbe9 100644 (file)
@@ -594,7 +594,7 @@ internal class Vala.GSignalModule : GObjectModule {
                if (ma.inner != null) {
                        ccall.add_argument ((CCodeExpression) get_ccodenode (ma.inner));
                } else {
-                       ccall.add_argument (new CCodeIdentifier ("self"));
+                       ccall.add_argument (get_result_cexpression ("self"));
                }
 
                if (sig is DynamicSignal) {
@@ -671,10 +671,10 @@ internal class Vala.GSignalModule : GObjectModule {
                                if (right_ma.inner != null) {
                                        ccall.add_argument ((CCodeExpression) right_ma.inner.ccodenode);
                                } else {
-                                       ccall.add_argument (new CCodeIdentifier ("self"));
+                                       ccall.add_argument (get_result_cexpression ("self"));
                                }
                        } else if (handler is LambdaExpression) {
-                               ccall.add_argument (new CCodeIdentifier ("self"));
+                               ccall.add_argument (get_result_cexpression ("self"));
                        }
                        if (!disconnect && !(sig is DynamicSignal)
                            && in_gobject_instance (m)) {
index 2696259cea00e18250c53b4398cc1c65a6867437..eb19c7fbd60807f8eb50be656e05cfc22398b64b 100644 (file)
@@ -57,6 +57,7 @@ TESTS = \
        errors/bug579101.vala \
        errors/bug596228.vala \
        asynchronous/bug595735.vala \
+       asynchronous/bug595755.vala \
        asynchronous/bug596177.vala \
        dbus/basic-types.test \
        dbus/arrays.test \
diff --git a/tests/asynchronous/bug595755.vala b/tests/asynchronous/bug595755.vala
new file mode 100644 (file)
index 0000000..ac9bbd5
--- /dev/null
@@ -0,0 +1,11 @@
+class Foo : Object {
+       public signal void bar ();
+
+       public async void do_foo () {
+               bar.connect (() => {
+               });
+       }
+}
+
+void main () {
+}