PDA

View Full Version : QDBus: Marshall user defined type (QPixmap) in QDBusArgument doesn't work



gecko
19th February 2010, 17:33
Hello,
in order to get familiar with the QDBus mechanism,
i made some examples derived from examples/dbus/complexpingpong.
I use Qt 4.4.0.
First I extended the example to user-defined structures containing "elemantary data types" to be marshalled by the DBus, they work fine.

Then, i tried to marshall a QPixmap-Object by the DBus,
I know this is not very usefull, but nevertheless i want to make this example work.

Problem: The server program has a segmentation fault and crashes.



inline QDBusArgument &operator<<(QDBusArgument &argument, const QPixmap &pixmap)
{
QVariant variant;
variant = pixmap;
QDBusVariant dbusvariant = QDBusVariant(variant);

argument.beginStructure();
argument << dbusvariant; // erroneous !!!!
argument.endStructure();
return argument;
}


Erro during execution of the server and client programs:
The serialization indicated above is run cyclically many thousand times, then the segmentation error occurs.

Has anyone a hint or an idea ?