From 0a3290f2288695a2b05ae3824c18d01abe4195e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Tue, 9 Jan 2024 10:05:30 +0100 Subject: no-thread: don't block the main thread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Lorn Potter --- src/qml/qml/qqmltypeloader.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/qml/qml') 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 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 QQmlTypeLoader::getType(const QUrl &unNormalizedUrl m_thread->waitForNextMessage(); } } +#endif } return typeData; -- cgit v1.2.3