[vala] GAsync: Fix async methods with struct parameters



commit df2b1aef63399d722b9ffd0b8db41d08e88557ef
Author: Jürg Billeter <j bitron ch>
Date:   Sun Mar 21 16:33:44 2010 +0100

    GAsync: Fix async methods with struct parameters
    
    Fixes bug 613484.

 codegen/valagasyncmodule.vala     |    4 +++-
 tests/Makefile.am                 |    1 +
 tests/asynchronous/bug613484.vala |   12 ++++++++++++
 3 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valagasyncmodule.vala b/codegen/valagasyncmodule.vala
index c1212de..e6ffb0d 100644
--- a/codegen/valagasyncmodule.vala
+++ b/codegen/valagasyncmodule.vala
@@ -1,6 +1,6 @@
 /* valagasyncmodule.vala
  *
- * Copyright (C) 2008-2009  Jürg Billeter
+ * Copyright (C) 2008-2010  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -219,6 +219,8 @@ internal class Vala.GAsyncModule : GSignalModule {
 					var ma = new MemberAccess.simple (param.name);
 					ma.symbol_reference = param;
 					cparam = get_ref_cexpression (param.parameter_type, cparam, ma, param);
+				} else if (param.parameter_type.is_real_non_null_struct_type ()) {
+					cparam = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, cparam);
 				}
 
 				asyncblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (data_var, get_variable_cname (param.name)), cparam)));
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dbad7ba..b746e19 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -77,6 +77,7 @@ TESTS = \
 	asynchronous/bug599568.vala \
 	asynchronous/bug600827.vala \
 	asynchronous/bug601558.vala \
+	asynchronous/bug613484.vala \
 	dbus/basic-types.test \
 	dbus/arrays.test \
 	dbus/structs.test \
diff --git a/tests/asynchronous/bug613484.vala b/tests/asynchronous/bug613484.vala
new file mode 100644
index 0000000..581686f
--- /dev/null
+++ b/tests/asynchronous/bug613484.vala
@@ -0,0 +1,12 @@
+struct Foo {
+	int i;
+}
+
+void do_foo (Foo foo) {
+}
+
+async void do_foo_async (Foo foo) {
+}
+
+void main () {
+}



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