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

Dmitry Shachnev null at kde.org
Thu May 5 10:59:25 BST 2022


Git commit 247c3e76b047e69363890fe174c560c0c7e5556a by Dmitry Shachnev, on behalf of Lu Yaning.
Committed on 13/11/2021 at 13:36.
Pushed by jriddell into branch 'Neon/release'.

Backport upstream patch to fix recursion crash.

M  +3    -0    debian/changelog
A  +56   -0    debian/patches/fix_recursion_crash.diff
M  +1    -0    debian/patches/series

https://invent.kde.org/neon/qt/qtbase/commit/247c3e76b047e69363890fe174c560c0c7e5556a

diff --git a/debian/changelog b/debian/changelog
index 49410bb..a49527a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,8 @@
 qtbase-opensource-src (5.15.2+dfsg-13) UNRELEASED; urgency=medium
 
+  [ Lu YaNing ]
+  * Backport upstream patch to fix recursion crash when calling
+    setStyleSheet with `qproperty-styleSheet`: fix_recursion_crash.diff.
 
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Sat, 13 Nov 2021 16:20:31 +0300
 
diff --git a/debian/patches/fix_recursion_crash.diff b/debian/patches/fix_recursion_crash.diff
new file mode 100644
index 0000000..0a1a3d5
--- /dev/null
+++ b/debian/patches/fix_recursion_crash.diff
@@ -0,0 +1,56 @@
+Description: 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.
+Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=e9cdcc7cb314586a
+Last-Update: 2021-11-13
+
+--- a/src/widgets/styles/qstylesheetstyle.cpp
++++ b/src/widgets/styles/qstylesheetstyle.cpp
+@@ -2626,6 +2626,9 @@ void QStyleSheetStyle::setProperties(QWi
+         default: v = decl.d->values.at(0).variant; break;
+         }
+ 
++        if (propertyL1 == QByteArray("styleSheet") && value == v)
++            continue;
++
+         w->setProperty(propertyL1, v);
+     }
+ }
+--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
++++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+@@ -94,6 +94,7 @@ private slots:
+     void layoutSpacing();
+ #endif
+     void qproperty();
++    void qproperty_styleSheet();
+     void palettePropagation_data();
+     void palettePropagation();
+     void fontPropagation_data();
+@@ -677,6 +678,23 @@ void tst_QStyleSheetStyle::qproperty()
+     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 d1f97ab..b2e979b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,6 +11,7 @@ fusion_checkable_qpushbutton.diff
 mysql_remove_version_checks.diff
 full_width_selection_rtl.diff
 xcb_add_a_timeout_control_when_reading_INCR_property.diff
+fix_recursion_crash.diff
 
 # Debian specific.
 gnukfreebsd.diff



More information about the Neon-commits mailing list