diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2024-08-14 11:14:08 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2024-08-21 19:57:58 +0200 |
| commit | aeabdb93885e51d5c7dbecbb69af1750370a65fa (patch) | |
| tree | 0454216e63c7963aaf701b3403fad66805dd1e99 /src/qmlcompiler/qqmljsfunctioninitializer.cpp | |
| parent | d9b13de4e86d33bc533855baa3e70492288b4ba3 (diff) | |
QML: Type-check objects passed to QmlListWrapper
So far we could assign QObjects of any type into any QmlListWrapper of
another type. This is UB, since you may be holding the underlying
QQmlListProperty in C++, and it's also not very consistent.
Assign null instead if the type doesn't match and emit a warning.
Likewise, also warn when initializing a list with mismatched elements.
[ChangeLog][QtQml][Important Behavior Changes] Assignments to list
properties in QML are now type-checked. Before you could, for example,
insert a plain QObject into list<Item>, producing undefined behavior.
Now it instead inserts null and warns. In particular, if you assign a
JavaScript array of random objects to a list property, QML will check
each individual element, and insert null as well as warn when
encountering type incompatibilities.
Pick-to: 6.8 6.7 6.5
Fixes: QTBUG-127343
Change-Id: I9b78afcd3ed40c80175a99861373588f56683954
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsfunctioninitializer.cpp')
0 files changed, 0 insertions, 0 deletions
