From: Jürg Billeter Date: Thu, 13 Nov 2008 13:08:56 +0000 (+0000) Subject: Fix retrieving D-Bus structs with owned strings X-Git-Tag: VALA_0_5_2~99 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ac482f9decc241676c75e237097e889f1256cd2;p=thirdparty%2Fvala.git Fix retrieving D-Bus structs with owned strings 2008-11-13 Jürg Billeter * gobject/valadbusclientmodule.vala: Fix retrieving D-Bus structs with owned strings svn path=/trunk/; revision=2012 --- diff --git a/ChangeLog b/ChangeLog index 8456d0036..6cc272d55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-11-13 Jürg Billeter + + * gobject/valadbusclientmodule.vala: + + Fix retrieving D-Bus structs with owned strings + 2008-11-13 Jürg Billeter * gobject/valaccodebasemodule.vala: diff --git a/gobject/valadbusclientmodule.vala b/gobject/valadbusclientmodule.vala index 0fb1d704c..92273619d 100644 --- a/gobject/valadbusclientmodule.vala +++ b/gobject/valadbusclientmodule.vala @@ -345,7 +345,16 @@ public class Vala.DBusClientModule : GAsyncModule { var cget_call = new CCodeFunctionCall (new CCodeIdentifier (f.field_type.data_type.get_get_value_function ())); cget_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeElementAccess (new CCodeMemberAccess.pointer (new CCodeIdentifier ("dbus_%s".printf (param.name)), "values"), new CCodeConstant (i.to_string ())))); - var assign = new CCodeAssignment (new CCodeMemberAccess.pointer (new CCodeIdentifier (param.name), f.name), cget_call); + + var converted_value = cget_call; + + if (requires_copy (f.field_type)) { + var dupexpr = get_dup_func_expression (f.field_type, expr.source_reference); + converted_value = new CCodeFunctionCall (dupexpr); + converted_value.add_argument (cget_call); + } + + var assign = new CCodeAssignment (new CCodeMemberAccess.pointer (new CCodeIdentifier (param.name), f.name), converted_value); out_marshalling_fragment.append (new CCodeExpressionStatement (assign)); type_call.add_argument (new CCodeIdentifier (f.field_type.data_type.get_type_id ()));