[neon/qt6/qt6-declarative/Neon/release] debian/patches: backport ffb557ff17d45684aac159762ae4bcc8a04ba573 to fix kirigami crashes
Carlos De Maine
null at kde.org
Tue Nov 5 02:49:18 GMT 2024
Git commit 2cc8821e2eb8f6c7f2f27e7cd72cf529bbfc18c2 by Carlos De Maine.
Committed on 05/11/2024 at 02:49.
Pushed by carlosdem into branch 'Neon/release'.
backport ffb557ff17d45684aac159762ae4bcc8a04ba573 to fix kirigami crashes
A +90 -0 debian/patches/kirigami_crashes.diff
M +5 -1 debian/patches/series
https://invent.kde.org/neon/qt6/qt6-declarative/-/commit/2cc8821e2eb8f6c7f2f27e7cd72cf529bbfc18c2
diff --git a/debian/patches/kirigami_crashes.diff b/debian/patches/kirigami_crashes.diff
new file mode 100644
index 0000000..db2ef3c
--- /dev/null
+++ b/debian/patches/kirigami_crashes.diff
@@ -0,0 +1,90 @@
+diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
+index bc9f240..7497da1 100644 (file)
+--- a/src/quick/items/qquickitem.cpp
++++ b/src/quick/items/qquickitem.cpp
+@@ -8751,9 +8751,10 @@ QPointF QQuickItem::mapToItem(const QQuickItem *item, const QPointF &point) cons
+ {
+ QPointF p = mapToScene(point);
+ if (item) {
+- const QQuickWindow *itemWindow = item->window();
+- if (itemWindow != nullptr && itemWindow != window())
+- p = itemWindow->mapFromGlobal(window()->mapToGlobal(p));
++ const auto *itemWindow = item->window();
++ const auto *thisWindow = window();
++ if (thisWindow && itemWindow && itemWindow != thisWindow)
++ p = itemWindow->mapFromGlobal(thisWindow->mapToGlobal(p));
+
+ p = item->mapFromScene(p);
+ }
+@@ -8858,9 +8859,10 @@ QPointF QQuickItem::mapFromItem(const QQuickItem *item, const QPointF &point) co
+ QPointF p = point;
+ if (item) {
+ p = item->mapToScene(point);
+-
+- if (item->window() != window())
+- p = window()->mapFromGlobal(item->window()->mapToGlobal(p));
++ const auto *itemWindow = item->window();
++ const auto *thisWindow = window();
++ if (thisWindow && itemWindow && itemWindow != thisWindow)
++ p = thisWindow->mapFromGlobal(itemWindow->mapToGlobal(p));
+ }
+ return mapFromScene(p);
+ }
+diff --git a/tests/auto/quick/qquickitem2/data/mapCoordinatesWithWindows.qml b/tests/auto/quick/qquickitem2/data/mapCoordinatesWithWindows.qml
+index 98fc0e7..1696699 100644 (file)
+--- a/tests/auto/quick/qquickitem2/data/mapCoordinatesWithWindows.qml
++++ b/tests/auto/quick/qquickitem2/data/mapCoordinatesWithWindows.qml
+@@ -48,4 +48,15 @@ QtObject {
+ color: "cyan"
+ }
+ }
++
++ property Item itemWithoutWindowA: Item {
++ x: 20; y: 20
++ }
++ property Item itemWithoutWindowB: Item {
++ x: 40; y: 40
++ Item {
++ objectName: "childItemWithoutWindow"
++ x: 30; y: 30
++ }
++ }
+ }
+diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
+index 154c4a6..eb4f62e 100644 (file)
+--- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
++++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
+@@ -2945,6 +2945,33 @@ void tst_QQuickItem::mapCoordinatesWithWindows()
+ globalItemOffset(childItemInChildWindow, childItemInOtherWindow));
+ QCOMPARE(childItemInChildWindow->mapFromItem(childItemInOtherWindow, {0, 0}),
+ globalItemOffset(childItemInOtherWindow, childItemInChildWindow));
++
++ // If one or both of the items are not in a scene (yet), they are assumed
++ // to eventually be in the same scene.
++
++ auto *itemWithoutWindowA = root->property("itemWithoutWindowA").value<QQuickItem*>();
++ QVERIFY(itemWithoutWindowA);
++ auto *itemWithoutWindowB = root->property("itemWithoutWindowB").value<QQuickItem*>();
++ QVERIFY(itemWithoutWindowB);
++ auto *childItemWithoutWindow = itemWithoutWindowB->findChild<QQuickItem*>("childItemWithoutWindow");
++ QVERIFY(childItemWithoutWindow);
++
++ QPoint itemWithoutWindowAPos = itemWithoutWindowA->position().toPoint();
++ QPoint itemWithoutWindowBPos = itemWithoutWindowB->position().toPoint();
++
++ QCOMPARE(itemWithoutWindowA->mapToItem(childItemWithoutWindow, {0, 0}),
++ itemWithoutWindowAPos - (itemWithoutWindowBPos + childItemWithoutWindow->position()));
++ QCOMPARE(itemWithoutWindowA->mapFromItem(childItemWithoutWindow, {0, 0}),
++ (itemWithoutWindowBPos + childItemWithoutWindow->position()) - itemWithoutWindowAPos);
++
++ QCOMPARE(itemWithoutWindowA->mapToItem(childItem, {0, 0}),
++ itemWithoutWindowAPos - itemPos);
++ QCOMPARE(itemWithoutWindowA->mapFromItem(childItem, {0, 0}),
++ itemPos - itemWithoutWindowAPos);
++ QCOMPARE(childItem->mapToItem(itemWithoutWindowA, {0, 0}),
++ itemPos - itemWithoutWindowAPos);
++ QCOMPARE(childItem->mapFromItem(itemWithoutWindowA, {0, 0}),
++ itemWithoutWindowAPos - itemPos);
+ }
+
+ void tst_QQuickItem::transforms_data()
\ No newline at end of file
diff --git a/debian/patches/series b/debian/patches/series
index dbf1d65..14194d6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,8 @@
# https://bugs.kde.org/493116
# fixed in 6.8.1
network_applet_list.diff
-network_applet_list_2.diff
\ No newline at end of file
+network_applet_list_2.diff
+
+#carl reported https://codereview.qt-project.org/c/qt/qtdeclarative/+/579714 for backports
+# but superceded by https://codereview.qt-project.org/c/qt/qtdeclarative/+/595278
+kirigami_crashes.diff
\ No newline at end of file
More information about the Neon-commits
mailing list