Marshalling of the Structure and array of Structures from QT into GLib API (repeated because of mailer problems)

Bogdan Lotko boguslaw.lotko at chello.at
Mon Nov 28 05:48:04 PST 2011


Hello,

By sending a structure over the D-Bus using QT API as the last step I 
pack my structure s into QVariant and use the QVariant as an argument of 
me method.

QVariant v;

v.setValue( s );

myIf->asyncCall( "myMethod", v );

On GLib API, I receive the QValueArray *

Now I'd like to send QList<s>.

 From the Qt Side the procedure is the same, pack the list into QVariant 
and send.

QVariant v;

QList<s>   l;

v.setValue( l );

myIf->asyncCall( "myMethod", v );

BUT  What I receive on the GLib API is not the GValueArray * but the 
GPtrArray * is it correct?
( the attempt to unpack the GValueArray fails - the n_values is a 
accidental number and the application crashes by 
g_value_array_get_nth(...),
   whereas the unpacking of GPtrArray * seems to work correctly )

It is somehow misleading. I thought, that packing of an item into 
QVariant, will always result in a GValueArray * on GLib API.

Additionally for the method generated from the XML definition

<method name="myMethod">
<arg type="a(myStructureSignature)">
</method>

the compiler accepts both types of argument i.e. GValueArray * but the 
GPtrArray * could somebody explain why?

Thanks,

Bogdan





More information about the dbus mailing list