[neon/qt/qtbase/Neon/release] debian: Backport upstream patch to fix recursion crash

Lu Yaning null at kde.org
Thu May 5 10:59:25 BST 2022


Git commit 3b4d53a9b419f993afcd9b760720728c1c9602eb by Lu Yaning.
Committed on 13/09/2021 at 03:21.
Pushed by jriddell into branch 'Neon/release'.

Backport upstream patch to fix recursion crash

M  +4    -0    debian/changelog
A  +65   -0    debian/patches/fix_recursion_crash.diff
M  +1    -0    debian/patches/series

https://invent.kde.org/neon/qt/qtbase/commit/3b4d53a9b419f993afcd9b760720728c1c9602eb

diff --git a/debian/changelog b/debian/changelog
index e3e44c8..224788d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,10 @@ qtbase-opensource-src (5.15.2+dfsg-11) UNRELEASED; urgency=medium
   * Apply multi-arch hints.
     + qtbase5-doc, qtbase5-doc-dev, qtbase5-doc-html: Add Multi-Arch: foreign.
 
+  [ Lu Yaning ]
+  * Backport upstream patch to fix recursion crash when calling
+    setStyleSheet with `qproperty-styleSheet`: fix_recursion_crash.diff.
+
  -- Debian Janitor <janitor at jelmer.uk>  Fri, 27 Aug 2021 23:06:45 -0000
 
 qtbase-opensource-src (5.15.2+dfsg-10) unstable; urgency=medium
diff --git a/debian/patches/fix_recursion_crash.diff b/debian/patches/fix_recursion_crash.diff
new file mode 100644
index 0000000..d9cdd04
--- /dev/null
+++ b/debian/patches/fix_recursion_crash.diff
@@ -0,0 +1,65 @@
+From e9cdcc7cb314586aec76b8b9979435f0af963443 Mon Sep 17 00:00:00 2001
+From: Zhang Yu <zhangyub at uniontech.com>
+Date: Tue, 15 Jun 2021 21:05:41 +0800
+Subject: [PATCH] Fix recursion crash when calling setStyleSheet with `qproperty-styleSheet`
+
+When calling `setStyleSheet` with property `qproperty-styleSheet`,
+`QStyleSheetStyle::polish` will call`QStyleSheetStyle::setProperties`, and then`QStyleSheetStyle::setProperties` goes on to call `setProperty`.Because there is property `qproperty-styleSheet`, it will update stylesheet by calling QStyleSheetStyle::polish`.
+This causes the recursive call to crash.
+
+Fixes: QTBUG-94448
+Pick-to: 5.15 6.2
+Change-Id: I79c51192a939b0b62e5b1d0dcc90d38f79e28222
+Reviewed-by: Jarek Kobus <jaroslaw.kobus at qt.io>
+---
+
+diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
+index b02e401..226c1ec 100644
+--- a/src/widgets/styles/qstylesheetstyle.cpp
++++ b/src/widgets/styles/qstylesheetstyle.cpp
+@@ -2670,6 +2670,9 @@
+         default: v = decl.d->values.at(0).variant; break;
+         }
+ 
++        if (propertyL1 == QByteArrayView("styleSheet") && value == v)
++            continue;
++
+         w->setProperty(propertyL1, v);
+     }
+ }
+diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+index 6c4c7d5..2750017 100644
+--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
++++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+@@ -92,6 +92,7 @@
+     void layoutSpacing();
+ #endif
+     void qproperty();
++    void qproperty_styleSheet();
+     void palettePropagation_data();
+     void palettePropagation();
+     void fontPropagation_data();
+@@ -672,6 +673,23 @@
+     QCOMPARE(pb.isChecked(), false);
+ }
+ 
++void tst_QStyleSheetStyle::qproperty_styleSheet()
++{
++    QWidget w;
++    auto checkBox = new QCheckBox("check", &w);
++    QString sheet = R"(QCheckBox { qproperty-styleSheet: "QCheckBox { qproperty-text: foobar; }"; })";
++
++    QVERIFY(w.property("styleSheet").toString().isEmpty());
++
++    w.setStyleSheet(sheet);
++    QCOMPARE(checkBox->text(), "check");
++
++    //recursion crash
++    w.ensurePolished();
++    QCOMPARE(w.property("styleSheet").toString(), sheet);
++    QCOMPARE(checkBox->text(), "foobar");
++}
++
+ namespace ns {
+     class PushButton1 : public QPushButton {
+         Q_OBJECT
diff --git a/debian/patches/series b/debian/patches/series
index 0dbb5a0..60b184f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,6 +10,7 @@ fix-placement-of-placeholder-text-in-QLineEdits-with-action-icons.diff
 fusion_checkable_qpushbutton.diff
 mysql_remove_version_checks.diff
 full_width_selection_rtl.diff
+fix_recursion_crash.diff
 
 # Debian specific.
 gnukfreebsd.diff



More information about the Neon-commits mailing list