Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.2.4, 6.3.2
-
MSVC 2019 16.11.19
-
-
91ce865050b9e017e63ae5b0c54e2d385705d155 aea43bdd4c (qt/tqtc-qtdeclarative/6.2)
Description
I have encountered following weird behavior. If you have property with non-literal expression (anything that requires evaluation) like in the code below, the program fails at runtime with assetion failure in debug mode (and crashes in release). But this happens only when qmlcachegen is disabled.
import QtQuick Window { width: 640 height: 480 visible: true title: qsTr("Hello World") component InlineComp: QtObject { property Component normComp: Component { QtObject { property int x: 1 + 1 // property int x: 1 // This works fine } } } InlineComp {} }
So, the above causes:
ASSERT: "index >= 0 && index < count" in file C:\Users\qt\work\qt\qtdeclarative\include\QtQml\6.3.2\QtQml\private\../../../../../src/qml/common/qqmljsfixedpoolarray_p.h, line 108
but only if you disable qmlcachegen. So with CMake you need to add NO_CACHEGEN to qt_add_qml_module(). With QMake qmlcachegen is disabled by default, so the bug will occur unless you set CONFIG+=qtquickcompiler. Same with Qbs, although it seems Qbs has different rules for qmlcachegen and I haven't found a way to mitigate it.
I'm not sure if this is a bug, cause I recall inline components can not be nested, but does it apply to Component inside inline component? Still the behavior is strange and shady.
I will attach MRE programs for Qbs, CMake and QMake. (I will cause when trying to attach the file now I have "Jira could not attach the file as there was a missing token. Please try attaching the file again", something similar to: https://jira.atlassian.com/browse/JRASERVER-69054)
Experienced this with MSVC 2019 (Community) version 16.11.19 (I have performed an upgrade - was the same with some previous minor release), haven't checked on Linux yet.