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)