Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
6.3, 6.4, 6.5, 6.6, 6.7
-
None
Description
Problem
QList<GADGET> property on dynamic replica crashes.
This is the case when dynamic replicas are used from Qml or the property is accessed by QObject::property("")
Reason
Call to QMetaProperty::metaType().construct(argv[0], value.data()) with different QMetaTypes of Property and Value in QRemoteObjectDynamicReplica::qt_metacall().
With the introduction of QtROSequentialContainer, QDataStreamCodec::serializeDefinition() replaces properties like QList<GADGET> with QtROSequentialContainer. However, the internal property values are decoded, which leads to the crash when tried to copy-construct.
Tests
/qremoteobjects/tests/auto/integration/pod.rep:
POD MyPOD(int i, float f, QString s) class MyClass { PROP(MyPOD myPOD) PROP(QList<MyPOD> myPODs) SLOT(QMap<QString, MyPOD> myPodMap()) SLOT(QList<MyPOD> myPodList()) }
/qremoteobjects/tests/auto/integration/tst_integration.cpp
void PODTest() { //... myclass_r->property("myPODs"); //<--- no crash auto dynRep = client->acquireDynamic("MyClass"); QVERIFY(dynRep->waitForSource(1000)); dynRep->property("myPODs"); //<--- !! CRASH !! }
Patch
I would be happy to contribute a patch for this, but I would need to know the intended behavior.
What is the intended "return type" for QRemoteObjectDynamicReplica::qt_metacall in this case?
Although QtROSequentialContainer inherits from QVariantList, I think exposing this class is not a good idea since this is private api.
Is something really expecting the type described by the meta type definition, or would it be okay to "return" QList<GADGET>?
mbrasser You mentioned Qml support in your initial commit. How would that be possible?