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>
This commit is contained in:
parent
2f3ef4e983
commit
5af5015b0c
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue