Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.15.0, 5.15.1
-
MSVC 2019 16.7.2 x64 Debug
-
-
3eb9ee34c06d54ea21fedd3188c60e536a487b1c (qt/qtdeclarative/dev) 95f8cd5632dcb72ec4fa7910099f210ce5f22078 (qt/qtdeclarative/5.15)
Description
Consider the following main.qml:
import QtQuick 2.15 import QtQuick.Window 2.15 Window { width: 640 height: 480 visible: true title: qsTr("Hello World") component InlineComponent : Rectangle {} component InlineComponent2 : Rectangle {} }
Running this code on MSVC Debug build crashes on runtime with assertion failed. See the callstack:
Qt5Qmld.dll!std::_Debug_lt_pred<bool <lambda>(QQmlImportInstance *, QQmlImportInstance *) &,QQmlImportInstance * &,QQmlImportInstance * &,0>(QQmlImportNamespace::resolveType::__l7::bool <lambda>(QQmlImportInstance *, QQmlImportInstance *) & _Pred, QQmlImportInstance * & _Left, QQmlImportInstance * & _Right) Line 1485 C++ Qt5Qmld.dll!std::_Insertion_sort_unchecked<QList<QQmlImportInstance *>::iterator,bool <lambda>(QQmlImportInstance *, QQmlImportInstance *)>(QList<QQmlImportInstance *>::iterator _First, const QList<QQmlImportInstance *>::iterator _Last, QQmlImportNamespace::resolveType::__l7::bool <lambda>(QQmlImportInstance *, QQmlImportInstance *) _Pred) Line 3329 C++ Qt5Qmld.dll!std::stable_sort<QList<QQmlImportInstance *>::iterator,bool <lambda>(QQmlImportInstance *, QQmlImportInstance *)>(const QList<QQmlImportInstance *>::iterator _First, const QList<QQmlImportInstance *>::iterator _Last, QQmlImportNamespace::resolveType::__l7::bool <lambda>(QQmlImportInstance *, QQmlImportInstance *) _Pred) Line 3666 C++ > Qt5Qmld.dll!QQmlImportNamespace::resolveType(QQmlTypeLoader * typeLoader, const QHashedStringRef & type, int * vmajor, int * vminor, QQmlType * type_return, QString * base, QList<QQmlError> * errors, QQmlType::RegistrationType registrationType, bool * typeRecursionDetected) Line 995 C++ Qt5Qmld.dll!QQmlImportsPrivate::resolveType::__l2::<lambda>(QHashedStringRef unqualifiedtype, QQmlImportNamespace * nameSpace, QList<QQmlError> * errors) Line 866 C++ Qt5Qmld.dll!QQmlImportsPrivate::resolveType(const QHashedStringRef & type, int * vmajor, int * vminor, QQmlType * type_return, QList<QQmlError> * errors, QQmlType::RegistrationType registrationType, bool * typeRecursionDetected) Line 882 C++ Qt5Qmld.dll!QQmlImports::resolveType(const QHashedStringRef & type, QQmlType * type_return, int * vmaj, int * vmin, QQmlImportNamespace * * ns_return, QList<QQmlError> * errors, QQmlType::RegistrationType registrationType, bool * typeRecursionDetected) Line 606 C++ Qt5Qmld.dll!QQmlTypeData::resolveType(const QString & typeName, int & majorVersion, int & minorVersion, QQmlTypeData::TypeReference & ref, int lineNumber, int columnNumber, bool reportErrors, QQmlType::RegistrationType registrationType, bool * typeRecursionDetected) Line 995 C++ Qt5Qmld.dll!QQmlTypeData::resolveTypes() Line 871 C++ Qt5Qmld.dll!QQmlTypeData::allDependenciesDone() Line 746 C++ Qt5Qmld.dll!QQmlTypeLoader::setData(QQmlDataBlob * blob, const QQmlDataBlob::SourceCodeData & d) Line 452 C++ Qt5Qmld.dll!QQmlTypeLoader::setData(QQmlDataBlob * blob, const QString & fileName) Line 438 C++ Qt5Qmld.dll!QQmlTypeLoader::loadThread(QQmlDataBlob * blob) Line 301 C++ Qt5Qmld.dll!QQmlTypeLoaderThread::loadThread(QQmlDataBlob * b) Line 163 C++ Qt5Qmld.dll!`QQmlThread::callMethodInThread<QQmlDataBlob *,QQmlDataBlob *,QQmlTypeLoaderThread>'::`2'::I::call(QQmlThread * thread) Line 165 C++ Qt5Qmld.dll!QQmlThreadPrivate::threadEvent() Line 206 C++ Qt5Qmld.dll!QQmlThreadPrivate::event(QEvent * e) Line 143 C++ Qt5Cored.dll!QCoreApplicationPrivate::notify_helper(QObject * receiver, QEvent * event) Line 1224 C++ Qt5Cored.dll!doNotify(QObject * receiver, QEvent * event) Line 1153 C++ Qt5Cored.dll!QCoreApplication::notify(QObject * receiver, QEvent * event) Line 1140 C++ Qt5Guid.dll!QGuiApplication::notify(QObject * object, QEvent * event) Line 1936 C++ Qt5Cored.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1063 C++ Qt5Cored.dll!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Line 1459 C++ Qt5Cored.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1817 C++ Qt5Cored.dll!QEventDispatcherWin32::sendPostedEvents() Line 1082 C++ Qt5Cored.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 530 C++ Qt5Cored.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 140 C++ Qt5Cored.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 232 C++ Qt5Cored.dll!QThread::exec() Line 547 C++ Qt5Qmld.dll!QQmlThreadPrivate::run() Line 156 C++ Qt5Cored.dll!QThreadPrivate::start(void * arg) Line 405 C++ kernel32.dll!BaseThreadInitThunk() Unknown ntdll.dll!RtlUserThreadStart() Unknown
It seems that std::stable_sort is called from QQmlTypeData::resolveTypes with a comparison function that fails to meet the MSVC STL's debug assertions. The failure is triggered apparently when compare is called for two components that are inline defined.