diff options
author | Morten Sørvig <morten.sorvig@qt.io> | 2024-01-09 10:05:30 +0100 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2024-02-20 09:36:01 +0000 |
commit | 0a3290f2288695a2b05ae3824c18d01abe4195e0 (patch) | |
tree | b69c9a4eb5acc581e3731250b0a3440a87832a1b /src/qml | |
parent | d62b40c34ede1cbc4542e63b71b1b5197c661b15 (diff) |
no-thread: don't block the main thread
We can't block the main thread if the type loading
happens on the main thread - similar to the existing
case where we avoid blocking the type loader thread.
This effectively treats all urls as async urls here,
despite what QQmlFile::isSynchronous() might say.
Pick-to: 6.7
Fixes: QTBUG-120620
Change-Id: I69c6c829d8c5a7950f457efaab0bb631a42554b5
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 838bec8824..a74397bd93 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -977,6 +977,7 @@ QQmlRefPointer<QQmlTypeData> QQmlTypeLoader::getType(const QUrl &unNormalizedUrl // this was started Asynchronous, but we need to force Synchronous // completion now (if at all possible with this type of URL). +#if QT_CONFIG(thread) if (!m_thread->isThisThread()) { // this only works when called directly from the UI thread, but not // when recursively called on the QML thread via resolveTypes() @@ -985,6 +986,7 @@ QQmlRefPointer<QQmlTypeData> QQmlTypeLoader::getType(const QUrl &unNormalizedUrl m_thread->waitForNextMessage(); } } +#endif } return typeData; |