Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
5.15, 6.5
-
None
-
710d650d0 (dev), 73b2e33d7 (6.7), 08596ea03 (tqtc/lts-6.5)
Description
QQmlEnginePrivate::rootContext
can be null in some cases when calling:
QObject *QQmlComponentPrivate::doBeginCreate(QQmlComponent *q, QQmlContext *context)
Causing this line to crash:
One example of this flow is as follows:
QQmlEngine deletes the rootContext in its destructor and invalidates the typeLoader:
https://github.com/qt/qtdeclarative/blob/4ddbef67357275ba6f100ce028a81c92405720b7/src/qml/qml/qqmlengine.cpp#L565
Which calls:
void QQmlTypeLoader::shutdownThread() { if (m_thread && !m_thread->isShutdown()) m_thread->shutdown(); //QQmlThread::shutdown() }
The QmlThread processes any events left in the list, some of which can be related to asynchronous component creation e.g.
QQmlComponentPrivate::typeDataReady(QQmlTypeData *) override;
Which triggers a "QQmlComponent::statusChanged" signal to "QQmlComponent::Ready"
If the end user is still connected, they may attempt to finish creating the component with "QQmlComponent::create(nullptr)" (use rootContext as context) leading us to the crash described at the start.
Example project of the crash is attached
Attachments
Issue Links
- resulted in
-
QTBUG-128269 QQmlEngine destructor hangs on QQmlTypeLoader::invalidate
- Closed