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

QML engine mis-converts QQmlListProperty

    XMLWordPrintable

Details

    • bb698b7f2 (dev), 20fd12d7f (6.6), 18acf2209 (tqtc/lts-6.5), 3796fcd83 (tqtc/lts-6.2)

    Description

      Consider:

      import QtQml
      
      QtObject {
          property list<QtObject> objs: [
              QtObject {},
              QtObject {}
          ]
      
          function returnObjs() : list<QtObject> {
              objs.push(this); // do something we cannot compile to C++
              return objs
          }
      
          Component.onCompleted: {
              var local = returnObjs();
              console.log(local[0], local[1], local[2]);
          }
      }
      

      This crashes when compiled to C++. The onCompleted handler is compiled to C++ and the returnObjs() function is not. However, the engine cannot properly convert QQmlListProperty to itself and returns a default-constructed list property there. The default-constructed list property does not have an at() method, which we assume to be available in generated code.

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            ulherman Ulf Hermann
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes