Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.10
-
None
Description
Disabling qml-locale segfaults qmltc. I compiled recent 'dev' Qt with following configure:
configure -no-feature-widgets -no-feature-qml-locale -no-warnings-are-errors -confirm-license -developer-build -debug -nomake tests -nomake examples -skip qtimageformats,qtlanguageserver -submodules qtbase,qtdeclarative,qtquicktimeline,qtsvg
If trying then to compile qmltc autotests, the qmltc segfaults in various places, for example:
/bin/sh: line 1: 78841 Segmentation fault: 11 build-macos/install/bin/qmltc --bare --header build-test/build_dir/QmltcTests/.qmltc/qmltc_test_module/mycheckbox.h --impl build-test/build_dir/QmltcTests/.qmltc/qmltc_test_module/mycheckbox.cpp --namespace QmltcTests --module QmltcTests -i build-test/build_dir/QmltcTests/qmldir -I build-macos/install/qml --resource build-test/build_dir/QmltcTests/.qt/rcc/qmake_immediate.qrc --resource build-test/build_dir/QmltcTests/.qt/rcc/qmake_QmltcTests.qrc --resource build-test/build_dir/QmltcTests/.qt/rcc/qmltc_test_module_raw_qml_0.qrc --meta-resource build-test/build_dir/QmltcTests/qmltc_test_module_qml_module_dir_map.qrc --resource build-test/build_dir/QmltcTests/.qmltc/qmltc_test_module/qmltc_test_module_qmltc_file_map.qrc source-dev-qt/qtdeclarative/tests/auto/qml/qmltc/QmltcTests/myCheckBox.qml
Please see the attached application project for a standalone reproducer.
In that reproducer the trigger is the:
import QtQuick.Templates as T
T.Slider {}
And the related segfault is:
/bin/sh: line 1: 3835 Segmentation fault: 11 /result-config-dynamic/build-macos/install/bin/qmltc --bare --header /build-qmllocale/.qmltc/appnoqmllocale/myslider.h --impl /build-qmllocale/.qmltc/appnoqmllocale/myslider.cpp --namespace noqmllocale --module noqmllocale -i /build-qmllocale/noqmllocale/qmldir -I /result-config-dynamic/build-macos/install/qml --resource /build-qmllocale/.qt/rcc/qmake_noqmllocale.qrc --resource /build-qmllocale/.qt/rcc/appnoqmllocale_raw_qml_0.qrc --meta-resource /build-qmllocale/noqmllocale/appnoqmllocale_qml_module_dir_map.qrc --resource /build-qmllocale/noqmllocale/.qmltc/appnoqmllocale/appnoqmllocale_qmltc_file_map.qrc /noqmllocale/MySlider.qml
I don't know why exaxtly Templates triggers the segfault. At least their implementation
does use QLocale quite a bit, but of course 'locale' is a distinct feature from
'qml-locale'. lldb shows there is bad memory access:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xe0) * frame #0: 0x0000000100d0c500 QtQmlCompiler`QString::size(this=0x00000000000000d0) const at qstring.h:242:18 frame #1: 0x0000000100d0b698 QtQmlCompiler`QString::isEmpty(this=0x00000000000000d0) const at qstring.h:249:54 frame #2: 0x0000000100f6a9c8 QtQmlCompiler`QQmlJSScope::augmentedInternalName(this=0x0000000000000000) const at qqmljsscope.cpp:222:5 frame #3: 0x00000001000a7f00 qmltc`getUnderlyingType(p=0x000000012f4c98c0) at qmltcpropertyutils.h:28:22 frame #4: 0x00000001000a50a0 qmltc`compilePropertyInitializer(current=0x000000012f48ae10, type=0x00006000028fbc70) at qmltccompiler.cpp:568:42 frame #5: 0x00000001000a1120 qmltc`QmltcCompiler::compileTypeElements(this=0x000000016fdfcae0, current=0x000000012f48ae10, type=0x00006000028fbc70) at qmltccompiler.cpp:658:5 frame #6: 0x00000001000f1544 qmltc`QmltcCompiler::compile(QmltcCompilerInfo const&)::$_3::operator()(this=0x000000016fdfc360, current=0x000000012f48ae10, type=0x00006000028fbc70) const at qmltccompiler.cpp:261:17
In Frame 2 the QQmlJSScope is nullptr (note: the crash is not the assert, but about the .isEmpty()):
frame #2: 0x0000000100f6a9c8 QtQmlCompiler`QQmlJSScope::augmentedInternalName(this=0x0000000000000000) const at qqmljsscope.cpp:222:5 219 QString QQmlJSScope::augmentedInternalName() const 220 { 221 using namespace Qt::StringLiterals; -> 222 Q_ASSERT(!m_internalName.isEmpty()); 223 224 switch (m_semantics) { 225 case AccessSemantics::Reference: (lldb) frame variable (const QQmlJSScope *) this = nullptr
And in Frame 3 we can see that the type being processed indeed relates to locale handling (abbreviated):
frame #3: 0x00000001000a7f00 qmltc`getUnderlyingType(p=0x000000012f4c98c0) at qmltcpropertyutils.h:28:22 25 + valueType->internalName() + u'>'; 26 } 27 -> 28 return p.type()->augmentedInternalName(); 29 } (lldb) frame variable (const QQmlJSMetaProperty &) p = 0x000000012f4c98c0: { m_propertyName = { d = { d = 0x0000600002613740 ptr = 0x0000600002613750 u"locale" size = 6 } } m_typeName = { d = { d = 0x0000600002613be0 ptr = 0x0000600002613bf0 u"QLocale" size = 7 } } m_read = { d = { d = 0x0000600002613da0 ptr = 0x0000600002613db0 u"locale" size = 6 } } m_write = { d = { d = 0x000060000281e2e0 ptr = 0x000060000281e2f0 u"setLocale" size = 9 } } m_reset = { d = { d = 0x000060000281e310 ptr = 0x000060000281e320 u"resetLocale" size = 11 } } m_notify = { d = { d = 0x000060000281e340 ptr = 0x000060000281e350 u"localeChanged" size = 13 } } // ... }