diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-02-05 18:49:39 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-02-06 11:32:34 +0100 |
commit | 5af5015b0c600bd49eecd0782193974ad9405107 (patch) | |
tree | 762731953274f20d7744a24fd0bbea99abacf869 /src | |
parent | 2f3ef4e983362ed8e0c6509ac371bebc58303f0a (diff) |
QQmlTypeLoader: Prevent further trivial cycles
We can also detect cycles in the WaitingForDependencies stage, not only
in the ResolvingDependencies stage. This is hard to test as the order of
state transitions depends on thread scheduling.
Also, do output a warning in those cases. Cyclic dependencies are bad
style.
Fixes: QTBUG-81678
Change-Id: I11f1a993afa29e4f2d6c71bb3379786d666a527a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/qml/qqmltypedata.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/qml/qqmltypedata.cpp b/src/qml/qml/qqmltypedata.cpp index f7abe67921..ebe4e32b48 100644 --- a/src/qml/qml/qqmltypedata.cpp +++ b/src/qml/qml/qqmltypedata.cpp @@ -833,8 +833,9 @@ void QQmlTypeData::resolveTypes() if (ref.type.isCompositeSingleton()) { ref.typeData = typeLoader()->getType(ref.type.sourceUrl()); - if (ref.typeData->status() == QQmlDataBlob::ResolvingDependencies || m_waitingOnMe.contains(ref.typeData.data())) { - // TODO: give an error message? If so, we should record and show the path of the cycle. + if (ref.typeData->isWaiting() || m_waitingOnMe.contains(ref.typeData.data())) { + qWarning() << "Cyclic dependency detected between" << ref.typeData->urlString() + << "and" << urlString(); continue; } addDependency(ref.typeData.data()); |