From: Jürg Billeter Date: Wed, 16 Jun 2010 18:35:31 +0000 (+0200) Subject: GAsync: Fix virtual async methods returning structs X-Git-Tag: 0.9.2~41 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=71957e0c2438fa559165ea6ac3f5f875d6a438a6;p=thirdparty%2Fvala.git GAsync: Fix virtual async methods returning structs Fixes bug 621768. --- diff --git a/codegen/valagasyncmodule.vala b/codegen/valagasyncmodule.vala index 506874571..508bac565 100644 --- a/codegen/valagasyncmodule.vala +++ b/codegen/valagasyncmodule.vala @@ -517,6 +517,12 @@ public class Vala.GAsyncModule : GSignalModule { return; } + var creturn_type = m.return_type; + if (m.return_type.is_real_non_null_struct_type ()) { + // structs are returned via out parameter + creturn_type = new VoidType (); + } + // add vfunc field to the type struct var vdeclarator = new CCodeFunctionDeclarator (m.vfunc_name); var cparam_map = new HashMap (direct_hash, direct_equal); @@ -533,7 +539,7 @@ public class Vala.GAsyncModule : GSignalModule { generate_cparameters (m, decl_space, cparam_map, new CCodeFunction ("fake"), vdeclarator, null, null, 2); - vdecl = new CCodeDeclaration (m.return_type.get_cname ()); + vdecl = new CCodeDeclaration (creturn_type.get_cname ()); vdecl.add_declarator (vdeclarator); type_struct.add_declaration (vdecl); }