]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Do not initialize temp variable when getting delegate property
authorLuca Bruno <lucabru@src.gnome.org>
Sat, 28 May 2011 07:30:52 +0000 (09:30 +0200)
committerJürg Billeter <j@bitron.ch>
Wed, 1 Jun 2011 13:26:03 +0000 (15:26 +0200)
Fixes bug 641182.

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

index 6d7e581a27b0e18e67f0e831bbf36b8ffe07e0b5..199f9d42865f93893d47c26cff5a32ca92a7cec3 100644 (file)
@@ -264,7 +264,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                                        } else {
                                                delegate_type = base_property.property_type as DelegateType;
                                                if (delegate_type != null && delegate_type.delegate_symbol.has_target) {
-                                                       temp_var = get_temp_variable (new PointerType (new VoidType ()));
+                                                       temp_var = get_temp_variable (new PointerType (new VoidType ()), false, expr, false);
                                                        ctemp = get_variable_cexpression (temp_var.name);
                                                        emit_temp_var (temp_var);
                                                        ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, ctemp));
index 723baa8a029fae4fde2ccd0e8a870ac3d50f674d..48267950ca4ad955bb4715045eb50e56c494e10a 100644 (file)
@@ -98,6 +98,7 @@ TESTS = \
        asynchronous/bug613484.vala \
        asynchronous/bug620740.vala \
        asynchronous/bug639591.vala \
+       asynchronous/bug641182.vala \
        asynchronous/closures.vala \
        dbus/basic-types.test \
        dbus/arrays.test \
diff --git a/tests/asynchronous/bug641182.vala b/tests/asynchronous/bug641182.vala
new file mode 100644 (file)
index 0000000..af7e396
--- /dev/null
@@ -0,0 +1,16 @@
+public delegate void Bar ();
+
+class Foo {
+        public Bar bar { get; set; }
+}
+
+async void test () {
+        var foo = new Foo ();
+        var i = 0;
+        foo.bar = () => { i++; };
+        foo.bar ();
+}
+
+void main() {
+        test ();
+}