]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Clear array ouptut parameters
authorJürg Billeter <j@bitron.ch>
Tue, 23 Feb 2010 19:13:26 +0000 (20:13 +0100)
committerJürg Billeter <j@bitron.ch>
Tue, 23 Feb 2010 19:13:26 +0000 (20:13 +0100)
codegen/valaccodemethodmodule.vala

index e83eb84c0986bc38574877b8e8fe18adb4c04310..f7b30ae476be17ea222cc4ad159a929f4aa0fb3c 100644 (file)
@@ -531,15 +531,18 @@ internal class Vala.CCodeMethodModule : CCodeStructModule {
                                                break;
                                        }
 
-                                       var t = param.parameter_type.data_type;
-                                       if (t != null && t.is_reference_type ()) {
-                                               if (param.direction != ParameterDirection.OUT) {
+                                       if (param.direction != ParameterDirection.OUT) {
+                                               var t = param.parameter_type.data_type;
+                                               if (t != null && t.is_reference_type ()) {
                                                        var type_check = create_method_type_check_statement (m, creturn_type, t, !param.parameter_type.nullable, get_variable_cname (param.name));
                                                        if (type_check != null) {
                                                                type_check.line = function.line;
                                                                cinit.append (type_check);
                                                        }
-                                               } else if (!m.coroutine) {
+                                               }
+                                       } else if (!m.coroutine) {
+                                               var t = param.parameter_type.data_type;
+                                               if ((t != null && t.is_reference_type ()) || param.parameter_type is ArrayType) {
                                                        // ensure that the passed reference for output parameter is cleared
                                                        var a = new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_variable_cexpression (param.name)), new CCodeConstant ("NULL"));
                                                        var cblock = new CCodeBlock ();