diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-24 19:31:55 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-25 10:42:41 +0100 |
commit | b1f53bf6eaabc9caa4f1eb523ad605c6719c752c (patch) | |
tree | ca35ef9014a3d273b2616b137b552fa9e2197c19 /src/qmltest/quicktest.cpp | |
parent | 20370505b3b38a5eaa73692557cd80a0ecc60bff (diff) |
QML: Avoid cyclic references between ResolvedTypeRefence and CU
The compilation unit keeps a list of references to used types. Usually
those are references to types in other compilation units. However, in
the case of inline components they can be references to the same
compilation unit. In that case we should not addref() the compilation
unit, as that forms a cyclic reference.
Fixes: QTBUG-82768
Change-Id: I29d28f3a4780aad4fabd4aa2ed02ca0d0108987e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qmltest/quicktest.cpp')
-rw-r--r-- | src/qmltest/quicktest.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index 470b3c0f7a..443496c9bc 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -332,8 +332,9 @@ private: } }; - TestCaseEnumerationResult enumerateTestCases(QV4::ExecutableCompilationUnit *compilationUnit, - const Object *object = nullptr) + TestCaseEnumerationResult enumerateTestCases( + const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, + const Object *object = nullptr) { QQmlType testCaseType; for (quint32 i = 0, count = compilationUnit->importCount(); i < count; ++i) { @@ -356,9 +357,8 @@ private: if (!object) // Start at root of compilation unit if not enumerating a specific child object = compilationUnit->objectAt(0); - if (QV4::ExecutableCompilationUnit *superTypeUnit - = compilationUnit->resolvedTypes.value(object->inheritedTypeNameIndex) - ->compilationUnit.data()) { + if (const auto superTypeUnit = compilationUnit->resolvedTypes.value( + object->inheritedTypeNameIndex)->compilationUnit()) { // We have a non-C++ super type, which could indicate we're a subtype of a TestCase if (testCaseType.isValid() && superTypeUnit->url() == testCaseType.sourceUrl()) result.isTestCase = true; |