revert_singletons_change
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Thu, 26 Oct 2017 13:27:02 +0000 (14:27 +0100)
committerDmitry Shachnev <mitya57@debian.org>
Thu, 26 Oct 2017 13:27:02 +0000 (14:27 +0100)
Gbp-Pq: Name revert_singletons_change.patch

src/qml/qml/qqmlimport.cpp
src/qml/qml/qqmlmetatype.cpp
src/qml/qml/qqmlmetatype_p.h
tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp

index ccd287e1b6164fb3bb665062bee723db3ce050b6..0bd73174706b9bbf9d2ef42159fd9513e5d4f845 100644 (file)
@@ -471,17 +471,6 @@ void findCompositeSingletons(const QQmlImportNamespace &set, QList<QQmlImports::
                 resultList.append(ref);
             }
         }
-
-        if (QQmlTypeModule *module = QQmlMetaType::typeModule(import->uri, 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);
-            });
-        }
     }
 }
 
index ac670bdabb04c5a23811e7e0e2ed1ae891a97752..f028b7925b4485d085f41609aaa180b44220ef6c 100644 (file)
@@ -1265,18 +1265,6 @@ QQmlType QQmlTypeModule::type(const QV4::String *name, int minor) const
     return QQmlType();
 }
 
-void QQmlTypeModule::walkCompositeSingletons(const std::function<void(const QQmlType &)> &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)
 {
index 74b1cf0e064ed63b2ddd80bdcaf07299d3b9823d..3b3db948c7d89c2dfcbb27e56740808c4b36db05 100644 (file)
@@ -299,8 +299,6 @@ public:
     QQmlType type(const QHashedStringRef &, int) const;
     QQmlType type(const QV4::String *, int) const;
 
-    void walkCompositeSingletons(const std::function<void(const QQmlType &)> &callback) const;
-
     QQmlTypeModulePrivate *priv() { return d; }
 private:
     //Used by register functions and creates the QQmlTypeModule for them
index e75e51ed29b7927d63036c30dfd9a7706644c422..6ab84774f2242522dd836b60488bb8f2c923a167 100644 (file)
@@ -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<QQmlEngine> 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<QObject> 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<QObject> 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"