Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.2.10, 6.5.3, 6.6.1, 6.7.0 Beta1
-
Windows 10 22H2, MSVC 2019 x64
-
da6680cb2 (dev), 104c90e88 (6.7), 49a62c410 (6.6), 2658ce482 (tqtc/lts-6.5), 058ecd5d9 (tqtc/lts-6.2)
Description
Code
// TestClass.h class TestClass : public QObject { Q_OBJECT QML_ELEMENT Q_PROPERTY(qreal value READ value WRITE setValue RESET resetValue NOTIFY valueChanged FINAL) // ... };
// Main.qml import QtQuick import QtQuick.Controls.Basic import ResetIssue ApplicationWindow { width: 640 height: 480 visible: true TestClass { id: testClass } Column { Button { text: "Set" onClicked: testClass.value = 999 } Button { text: "Call Reset Function" onClicked: testClass.resetValue() } Button { text: "Assign undefined value" onClicked: testClass.value = undefined // JIT: Calls reset function // AOT: Calls setter function with NaN } Label { text: "Value: " + testClass.value } } }
Steps to reproduce
- Build and run the attached project
- Click "Set"
- Click "Call Reset Function"
- Click "Set"
- Click "Assign undefined value"
- Edit CMakeLists.txt to add "NO_CACHEGEN" to qt_add_qml_module(), and repeat the steps above
Outcomes
- Step #3 always calls resetValue() (expected)
- Step #5 calls setValue() with NaN if qmlsc/qmlcachegen is enabled, but calls resetValue() if qmlsc/qmlcachegen is disabled (not expected)
Attachments
For Gerrit Dashboard: QTBUG-120512 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
532057,2 | WIP: QmlCompiler: Implement resetting of properties | dev | qt/qtdeclarative | Status: ABANDONED | -2 | 0 |
532435,6 | QmlCompiler: Implement resetting of properties | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
534416,2 | QmlCompiler: Implement resetting of properties | 6.7 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
535857,3 | QmlCompiler: Implement resetting of properties | 6.6 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
536239,4 | QmlCompiler: Prohibit resetting of properties | tqtc/lts-6.5 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |
537313,1 | QmlCompiler: Prohibit resetting of properties | tqtc/lts-6.2 | qt/tqtc-qtdeclarative | Status: ABANDONED | 0 | 0 |
537542,4 | Prohibit SetLookup with potentially undefined values | tqtc/lts-6.2 | qt/tqtc-qmlcompilerplus | Status: MERGED | +2 | 0 |