Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-122437

QRemoteObjectDynamicReplica with QList<GADGET> crashes when accessed by meta call

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.3, 6.4, 6.5, 6.6, 6.7
    • Remote Objects
    • None
    • All

    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?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bstottle Brett Stottlemyer
            marc_h Marc Hüskens
            Brett Stottlemyer Brett Stottlemyer
            Michael Brasser Michael Brasser
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes