From 960bebd61f70c39e2fbce9f67b889cd64f48cea7 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 25 Sep 2017 11:55:20 +0200 Subject: QQmlTypeLoader: The profiler is a quintptr(0) if QT_NO_QML_DEBUGGING This follows the pattern established in other places. Task-number: QTBUG-63392 Change-Id: I11cd66d5552f751804dd0a9460b26bda546c1726 Reviewed-by: Mikko Gronoff Reviewed-by: Shawn Rutledge Reviewed-by: Samuli Piippo --- src/qml/qml/qqmltypeloader_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/qml/qml/qqmltypeloader_p.h') diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h index c214f0cd43..abc0df9068 100644 --- a/src/qml/qml/qqmltypeloader_p.h +++ b/src/qml/qml/qqmltypeloader_p.h @@ -322,8 +322,8 @@ public: void invalidate(); #ifdef QT_NO_QML_DEBUGGER - QQmlProfiler *profiler() const { return nullptr; } - void setProfiler(QQmlProfiler *) {} + quintptr profiler() const { return 0; } + void setProfiler(quintptr) {} #else QQmlProfiler *profiler() const { return m_profiler.data(); } void setProfiler(QQmlProfiler *profiler); -- cgit v1.2.3 From ffca73c79d7733f06416f211d5d544dd037c9532 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 18 Oct 2017 15:50:32 +0200 Subject: Tell QQmlImportInstance::resolveType what kind of type we want In QQmlTypeData::resolveTypes() we know if we're looking at a reference to a composite singleton type, or some other type reference. When we call resolveType() we expect the correct type to be returned, not only based on URL, but also based on its singleton property. QQmlTypeData::resolveType() eventually invokes QQmlImportInstance::resolveType() which will call fetchOrCreateTypeForUrl(), passing a parameter on whether the result should be a composite singleton. When operating on a qmldir component the component itself encodes this. When fetching a type from a local file without qmldir, we currently assume that it isn't a singleton, no matter QQmlTypeData::resolveTypes() has determined. This means that actual singletons loaded this way later get refused by the sanity check. In order to fix this, pass the information about the expected singleton property on to QQmlImportInstance. This is done using QQmlType::RegistrationType, which gets another entry for "any type". If the expected type is CompositeSingletonType QQmlTypeData::resolveType() will not create a non-singleton type. If it is any specific other type, it will not create a composite singleton. And if it is AnyRegistrationType, it will behave as it previously did. Change-Id: I6b7e082b63582e0aed946bb3d19077b94c7a45f7 Reviewed-by: Lars Knoll --- src/qml/qml/qqmltypeloader_p.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/qml/qml/qqmltypeloader_p.h') diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h index abc0df9068..ef63e02b4f 100644 --- a/src/qml/qml/qqmltypeloader_p.h +++ b/src/qml/qml/qqmltypeloader_p.h @@ -474,7 +474,10 @@ private: const QV4::CompiledData::ResolvedTypeReferenceMap &resolvedTypeCache, const QV4::CompiledData::DependentTypesHasher &dependencyHasher); void createTypeAndPropertyCaches(const QQmlRefPointer &typeNameCache, const QV4::CompiledData::ResolvedTypeReferenceMap &resolvedTypeCache); - bool resolveType(const QString &typeName, int &majorVersion, int &minorVersion, TypeReference &ref, int lineNumber = -1, int columnNumber = -1, bool reportErrors = true); + bool resolveType(const QString &typeName, int &majorVersion, int &minorVersion, + TypeReference &ref, int lineNumber = -1, int columnNumber = -1, + bool reportErrors = true, + QQmlType::RegistrationType registrationType = QQmlType::AnyRegistrationType); void scriptImported(QQmlScriptBlob *blob, const QV4::CompiledData::Location &location, const QString &qualifier, const QString &nameSpace) override; -- cgit v1.2.3