[neon/qt/qtdeclarative/Neon/release] debian: Backport patch to fix asynchronous loaders

Dmitry Shachnev null at kde.org
Thu Jul 14 14:03:40 BST 2022


Git commit b04d1737a7e11124e05d365719a0e1f05bf417e2 by Dmitry Shachnev, on behalf of Jonah BrĂ¼chert.
Committed on 01/07/2022 at 20:07.
Pushed by jriddell into branch 'Neon/release'.

Backport patch to fix asynchronous loaders

M  +6    -0    debian/changelog
A  +83   -0    debian/patches/QQuickLoader-Do-not-incubate-if-the-source-arrives-a.patch
M  +1    -0    debian/patches/series

https://invent.kde.org/neon/qt/qtdeclarative/commit/b04d1737a7e11124e05d365719a0e1f05bf417e2

diff --git a/debian/changelog b/debian/changelog
index 2d4fcc7..aa2fc2b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+qtdeclarative-opensource-src (5.15.4+dfsg-4) UNRELEASED; urgency=medium
+
+  * Backport upstream patch to fix asynchronous loaders loading when inactive
+
+ -- Jonah BrĂ¼chert <jbb at kaidan.im>  Tue, 28 Jun 2022 19:24:13 +0200
+
 qtdeclarative-opensource-src (5.15.4+dfsg-3) unstable; urgency=medium
 
   * Upload to unstable.
diff --git a/debian/patches/QQuickLoader-Do-not-incubate-if-the-source-arrives-a.patch b/debian/patches/QQuickLoader-Do-not-incubate-if-the-source-arrives-a.patch
new file mode 100644
index 0000000..b7126c3
--- /dev/null
+++ b/debian/patches/QQuickLoader-Do-not-incubate-if-the-source-arrives-a.patch
@@ -0,0 +1,83 @@
+Description: QQuickLoader: do not incubate if the source arrives after setActive(false)
+ Otherwise we end up in the crazy place of active being false but item
+ being non-null and forces us to workaround within the apps.
+Origin: upstream, https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=e78c068700fa74ab
+Last-Update: 2022-07-01
+
+--- a/src/quick/items/qquickloader.cpp
++++ b/src/quick/items/qquickloader.cpp
+@@ -737,6 +737,9 @@ void QQuickLoaderPrivate::_q_sourceLoade
+         return;
+     }
+ 
++    if (!active)
++        return;
++
+     QQmlContext *creationContext = component->creationContext();
+     if (!creationContext) creationContext = qmlContext(q);
+     itemContext = new QQmlContext(creationContext);
+--- /dev/null
++++ b/tests/auto/quick/qquickloader/data/loader-async-race-rect.qml
+@@ -0,0 +1,10 @@
++import QtQuick 2.15
++
++Rectangle {
++    anchors.fill: parent
++    color: "blue"
++    Item {
++        Item {
++        }
++    }
++}
+--- /dev/null
++++ b/tests/auto/quick/qquickloader/data/loader-async-race.qml
+@@ -0,0 +1,14 @@
++import QtQuick 2.15
++
++Item {
++    id: root
++    Component.onCompleted: {
++        myloader.active = false
++    }
++    Loader {
++        id: myloader
++        anchors.fill: parent
++        asynchronous: true
++        source: "loader-async-race-rect.qml"
++    }
++}
+--- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp
++++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
+@@ -132,6 +132,7 @@ private slots:
+     void statusChangeOnlyEmittedOnce();
+ 
+     void setSourceAndCheckStatus();
++    void asyncLoaderRace();
+ };
+ 
+ Q_DECLARE_METATYPE(QList<QQmlError>)
+@@ -1496,6 +1497,24 @@ void tst_QQuickLoader::setSourceAndCheck
+     QCOMPARE(loader->status(), QQuickLoader::Null);
+ }
+ 
++void tst_QQuickLoader::asyncLoaderRace()
++{
++    QQmlApplicationEngine engine;
++    auto url = testFileUrl("loader-async-race.qml");
++    engine.load(url);
++    auto root = engine.rootObjects().at(0);
++    QVERIFY(root);
++
++    QQuickLoader *loader = root->findChild<QQuickLoader *>();
++    QCOMPARE(loader->active(), false);
++    QCOMPARE(loader->status(), QQuickLoader::Null);
++    QCOMPARE(loader->item(), nullptr);
++
++    QSignalSpy spy(loader, &QQuickLoader::itemChanged);
++    QVERIFY(!spy.wait(100));
++    QCOMPARE(loader->item(), nullptr);
++}
++
+ QTEST_MAIN(tst_QQuickLoader)
+ 
+ #include "tst_qquickloader.moc"
diff --git a/debian/patches/series b/debian/patches/series
index 9cb5403..f9cda2c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,5 @@
 # Backported patches
+QQuickLoader-Do-not-incubate-if-the-source-arrives-a.patch
 gcc_11.patch
 tst_qmldiskcache_big_endian.patch
 support_apos_in_styled_text.patch



More information about the Neon-commits mailing list