Skip to content

Commit

Permalink
Avoid unlock/lock dance before waitForNextMessage
Browse files Browse the repository at this point in the history
Change-Id: I63f2c01b3ca28b0703be6af80f8f7e757948a852
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
  • Loading branch information
Inkane committed Sep 19, 2022
1 parent 7bcfc16 commit c506b71
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
3 changes: 1 addition & 2 deletions src/qml/qml/ftw/qqmlthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ void QQmlThread::internalPostMethodToMain(Message *message)
/*!
\internal
\note This method must be called in the main thread
\warning This method requires that the lock is held!
A call to this method will either:
- run a message requested to run synchronously on the main thread if there is one
Expand All @@ -377,7 +378,6 @@ void QQmlThread::waitForNextMessage()
#if QT_CONFIG(thread)
Q_ASSERT(!isThisThread());
#endif
d->lock();
Q_ASSERT(d->m_mainThreadWaiting == false);

d->m_mainThreadWaiting = true;
Expand All @@ -397,7 +397,6 @@ void QQmlThread::waitForNextMessage()
}

d->m_mainThreadWaiting = false;
d->unlock();
}


Expand Down
4 changes: 0 additions & 4 deletions src/qml/qml/qqmltypeloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,7 @@ void QQmlTypeLoader::doLoad(const Loader &loader, QQmlDataBlob *blob, Mode mode)
} else {
Q_ASSERT(mode == Synchronous);
while (!blob->isCompleteOrError()) {
unlock();
m_thread->waitForNextMessage();
lock();
}
}
}
Expand Down Expand Up @@ -908,9 +906,7 @@ QQmlRefPointer<QQmlTypeData> QQmlTypeLoader::getType(const QUrl &unNormalizedUrl
// when recursively called on the QML thread via resolveTypes()

while (!typeData->isCompleteOrError()) {
unlock();
m_thread->waitForNextMessage();
lock();
}
}
}
Expand Down

0 comments on commit c506b71

Please sign in to comment.