diff options
author | Andy Shaw <andy.shaw@qt.io> | 2017-04-26 00:16:16 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2017-05-02 08:23:14 +0000 |
commit | caa5358fe97becafeba9631f4c4d2fc69469afb1 (patch) | |
tree | 88b627a3646ce057ead3266bb79a2e7483052e73 /tests/auto | |
parent | 6a2febc680e163e56eb61d322d156dbf6fb07e0e (diff) |
Fix concurrent loading of the same qmldir from different scripts
QQmlQmldirData keeps a pointer to a QQmlScript::Import, and an integer
priority. Each Blob that is waiting on it was setting its own import
and priority even though the QQmlQmldirData itself was shared. This
resulted in whichever one began loading last succeeding to load,
and the rest failing. This change instead stores the import and
priority data per-dependent Blob
Fix was originally done by Josh Faust <jfaust@suitabletech.com>. I
added the test.
Task-number: QTBUG-30469
Change-Id: Id3d15569a999a7c22eeb12b431e5daf1ddae51dc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto')
4 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/ConcurrentLoadA.qml b/tests/auto/qml/qqmllanguage/data/ConcurrentLoadA.qml new file mode 100644 index 0000000000..3d538c7572 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/ConcurrentLoadA.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import testModule 1.0 + +Item { + Test {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/ConcurrentLoadB.qml b/tests/auto/qml/qqmllanguage/data/ConcurrentLoadB.qml new file mode 100644 index 0000000000..3d538c7572 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/ConcurrentLoadB.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import testModule 1.0 + +Item { + Test {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/concurrentLoad_main.qml b/tests/auto/qml/qqmllanguage/data/concurrentLoad_main.qml new file mode 100644 index 0000000000..8cfc90ac96 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/concurrentLoad_main.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 +Rectangle { +ConcurrentLoadA {} +ConcurrentLoadB {} +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 750c32cc3c..39f5082c70 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -263,6 +263,8 @@ private slots: void qmlTypeCanBeResolvedByName_data(); void qmlTypeCanBeResolvedByName(); + void concurrentLoadQmlDir(); + private: QQmlEngine engine; QStringList defaultImportPathList; @@ -4338,6 +4340,20 @@ void tst_qqmllanguage::qmlTypeCanBeResolvedByName() QVERIFY(!o.isNull()); } +void tst_qqmllanguage::concurrentLoadQmlDir() +{ + ThreadedTestHTTPServer server(dataDirectory()); + QString serverdir = server.urlString("/lib/"); + engine.setImportPathList(QStringList(defaultImportPathList) << serverdir); + + QQmlComponent component(&engine, testFileUrl("concurrentLoad_main.qml")); + QTRY_VERIFY(component.isReady()); + VERIFY_ERRORS(0); + QScopedPointer<QObject> o(component.create()); + QVERIFY(!o.isNull()); + engine.setImportPathList(defaultImportPathList); +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" |