From 1242bbb030762ccca8a306eff5d908dcd25ff530 Mon Sep 17 00:00:00 2001 From: Juerg Billeter Date: Sun, 6 Apr 2008 19:24:58 +0000 Subject: [PATCH] fix crash when using string arrays in parameters of D-Bus methods, fixes 2008-04-06 Juerg Billeter * gobject/valaccodegeneratorinvocationexpression.vala: fix crash when using string arrays in parameters of D-Bus methods, fixes bug 525166 svn path=/trunk/; revision=1167 --- ChangeLog | 6 ++++++ gobject/valaccodegeneratorinvocationexpression.vala | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a90f5be..8c3b47f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2008-04-06 Jürg Billeter + * gobject/valaccodegeneratorinvocationexpression.vala: fix crash + when using string arrays in parameters of D-Bus methods, + fixes bug 525166 + +2008-04-06 Jürg Billeter + * gobject/valaccodegenerator.vala, gobject/valaccodegeneratorclass.vala, gobject/valaccodegeneratorinterface.vala, diff --git a/gobject/valaccodegeneratorinvocationexpression.vala b/gobject/valaccodegeneratorinvocationexpression.vala index 97d952a..349766e 100644 --- a/gobject/valaccodegeneratorinvocationexpression.vala +++ b/gobject/valaccodegeneratorinvocationexpression.vala @@ -174,14 +174,16 @@ public class Vala.CCodeGenerator { var cdecl = new CCodeDeclaration (param.type_reference.get_cname ()); cdecl.add_declarator (new CCodeVariableDeclarator (param.name)); cb_fun.block.add_statement (cdecl); - cend_call.add_argument (new CCodeIdentifier (param.type_reference.data_type.get_type_id ())); - cend_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (param.name))); if (param.type_reference is ArrayType && ((ArrayType) param.type_reference).element_type.data_type == string_type.data_type) { // special case string array + cend_call.add_argument (new CCodeIdentifier ("G_TYPE_STRV")); var cstrvlen = new CCodeFunctionCall (new CCodeIdentifier ("g_strv_length")); cstrvlen.add_argument (new CCodeIdentifier (param.name)); creply_call.add_argument (cstrvlen); + } else { + cend_call.add_argument (new CCodeIdentifier (param.type_reference.data_type.get_type_id ())); } + cend_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (param.name))); creply_call.add_argument (new CCodeIdentifier (param.name)); } } -- 2.7.4