]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
GAsync: Fix virtual async methods returning structs
authorJürg Billeter <j@bitron.ch>
Wed, 16 Jun 2010 18:35:31 +0000 (20:35 +0200)
committerJürg Billeter <j@bitron.ch>
Wed, 16 Jun 2010 18:35:31 +0000 (20:35 +0200)
Fixes bug 621768.

codegen/valagasyncmodule.vala

index 50687457161e3f640390adb7e10b2eac6d7d6d22..508bac56528bdfa32ac2e6e25e2017a0287bb46f 100644 (file)
@@ -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<int,CCodeFormalParameter> (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);
        }