From: Debian Qt/KDE Maintainers Date: Thu, 26 Oct 2017 13:27:02 +0000 (+0100) Subject: revert_singletons_change X-Git-Tag: archive/raspbian/5.9.2-3+rpi1^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9e7c2b9b53db8541abd6440a334e0294555ab759;p=qtdeclarative-opensource-src.git revert_singletons_change Gbp-Pq: Name revert_singletons_change.patch --- diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index ccd287e1b..0bd731747 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -471,17 +471,6 @@ void findCompositeSingletons(const QQmlImportNamespace &set, QListuri, import->majversion)) { - module->walkCompositeSingletons([&resultList, &set](const QQmlType &singleton) { - QQmlImports::CompositeSingletonReference ref; - ref.typeName = singleton.elementName(); - ref.prefix = set.prefix; - ref.majorVersion = singleton.majorVersion(); - ref.minorVersion = singleton.minorVersion(); - resultList.append(ref); - }); - } } } diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index ac670bdab..f028b7925 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -1265,18 +1265,6 @@ QQmlType QQmlTypeModule::type(const QV4::String *name, int minor) const return QQmlType(); } -void QQmlTypeModule::walkCompositeSingletons(const std::function &callback) const -{ - QMutexLocker lock(metaTypeDataLock()); - for (auto typeCandidates = d->typeHash.begin(), end = d->typeHash.end(); - typeCandidates != end; ++typeCandidates) { - for (auto type: typeCandidates.value()) { - if (type->regType == QQmlType::CompositeSingletonType) - callback(QQmlType(type)); - } - } -} - QQmlTypeModuleVersion::QQmlTypeModuleVersion() : m_module(0), m_minor(0) { diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h index 74b1cf0e0..3b3db948c 100644 --- a/src/qml/qml/qqmlmetatype_p.h +++ b/src/qml/qml/qqmlmetatype_p.h @@ -299,8 +299,6 @@ public: QQmlType type(const QHashedStringRef &, int) const; QQmlType type(const QV4::String *, int) const; - void walkCompositeSingletons(const std::function &callback) const; - QQmlTypeModulePrivate *priv() { return d; } private: //Used by register functions and creates the QQmlTypeModule for them diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp index e75e51ed2..6ab84774f 100644 --- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp +++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp @@ -59,7 +59,6 @@ private slots: void cacheResources(); void stableOrderOfDependentCompositeTypes(); void singletonDependency(); - void cppRegisteredSingletonDependency(); }; // A wrapper around QQmlComponent to ensure the temporary reference counts @@ -791,66 +790,6 @@ void tst_qmldiskcache::singletonDependency() } } -void tst_qmldiskcache::cppRegisteredSingletonDependency() -{ - qmlClearTypeRegistrations(); - QScopedPointer engine(new QQmlEngine); - - QTemporaryDir tempDir; - QVERIFY(tempDir.isValid()); - - const auto writeTempFile = [&tempDir](const QString &fileName, const char *contents) { - QFile f(tempDir.path() + '/' + fileName); - const bool ok = f.open(QIODevice::WriteOnly | QIODevice::Truncate); - Q_ASSERT(ok); - f.write(contents); - return f.fileName(); - }; - - writeTempFile("MySingleton.qml", "import QtQml 2.0\npragma Singleton\nQtObject { property int value: 42 }"); - - qmlRegisterSingletonType(QUrl::fromLocalFile(tempDir.path() + QLatin1String("/MySingleton.qml")), "CppRegisteredSingletonDependency", 1, 0, "Singly"); - - const QString testFilePath = writeTempFile("main.qml", "import QtQml 2.0\nimport CppRegisteredSingletonDependency 1.0\nQtObject {\n" - " function getValue() { return Singly.value; }\n" - "}"); - - { - CleanlyLoadingComponent component(engine.data(), QUrl::fromLocalFile(testFilePath)); - QScopedPointer obj(component.create()); - QVERIFY(!obj.isNull()); - QVariant value; - QVERIFY(QMetaObject::invokeMethod(obj.data(), "getValue", Q_RETURN_ARG(QVariant, value))); - QCOMPARE(value.toInt(), 42); - } - - const QString testFileCachePath = testFilePath + QLatin1Char('c'); - QVERIFY(QFile::exists(testFileCachePath)); - QDateTime initialCacheTimeStamp = QFileInfo(testFileCachePath).lastModified(); - - engine.reset(new QQmlEngine); - waitForFileSystem(); - - writeTempFile("MySingleton.qml", "import QtQml 2.0\npragma Singleton\nQtObject { property int value: 100 }"); - waitForFileSystem(); - - { - CleanlyLoadingComponent component(engine.data(), QUrl::fromLocalFile(testFilePath)); - QScopedPointer obj(component.create()); - QVERIFY(!obj.isNull()); - - { - QVERIFY(QFile::exists(testFileCachePath)); - QDateTime newCacheTimeStamp = QFileInfo(testFileCachePath).lastModified(); - QVERIFY2(newCacheTimeStamp > initialCacheTimeStamp, qPrintable(newCacheTimeStamp.toString())); - } - - QVariant value; - QVERIFY(QMetaObject::invokeMethod(obj.data(), "getValue", Q_RETURN_ARG(QVariant, value))); - QCOMPARE(value.toInt(), 100); - } -} - QTEST_MAIN(tst_qmldiskcache) #include "tst_qmldiskcache.moc"