Details
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
For Gerrit Dashboard: QTBUG-117829 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
509012,5 | QtQml: Correctly convert to QQmlListProperty<QObject> | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
510194,3 | QtQml: Correctly convert to QQmlListProperty<QObject> | 6.6 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
513694,2 | QtQml: Correctly convert to QQmlListProperty<QObject> | tqtc/lts-6.5 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |
513912,3 | QtQml: Correctly convert to QQmlListProperty<QObject> | tqtc/lts-6.2 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |