From 77b913a1c7843e86a55c3b050a0762fcfb3f7fa1 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Mon, 6 Jul 2020 16:11:01 +0000 Subject: user/qt5-qtbase: Backport 5.13 fix for KDE #395181 --- user/qt5-qtbase/APKBUILD | 6 ++- user/qt5-qtbase/section-header.patch | 95 ++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 user/qt5-qtbase/section-header.patch (limited to 'user/qt5-qtbase') diff --git a/user/qt5-qtbase/APKBUILD b/user/qt5-qtbase/APKBUILD index 4cb68524d..8e51ff124 100644 --- a/user/qt5-qtbase/APKBUILD +++ b/user/qt5-qtbase/APKBUILD @@ -2,7 +2,7 @@ pkgname=qt5-qtbase _pkgname=qtbase-everywhere-src pkgver=5.12.6 -pkgrel=1 +pkgrel=2 pkgdesc="Cross-platform application and UI framework" url="https://www.qt.io/" arch="all" @@ -29,6 +29,7 @@ source="https://download.qt.io/official_releases/qt/${pkgver%.*}/$pkgver/submodu time64.patch CVE-2020-0569.patch CVE-2020-0570.patch + section-header.patch " # secfixes: qt @@ -182,4 +183,5 @@ ee78a44e28ba5f728914bfc3d8d5b467896c7de11a02d54b0bce11e40a4338b1f776c1fcc30cbd43 e3982b2df2ab4ba53b7a1329a9eb928eb1fee813c61cf6ac03d3300a767ffb57f019ac0fd89f633cac2330549446ff3d43344871296bf362815e7ebffadefa6b qt-musl-iconv-no-bom.patch 436f0bb7a89a88aa62c7b0398c4e91c325e78542e96f747c903f7e96dbf9d9b693d9688c722f2a74e287fb9ab31e861bd5ed8deb172ed28f56a1b8757663771c time64.patch ddeb0a59cf0901b38669314fd2f14dffba63c6cbd06a3d864cd329081cc2b10323ec52053a6ffe7baf5ee8a1e137331acfe5d874c03596660630dd151828da56 CVE-2020-0569.patch -b5973799d6dc7c03124b7df5424e5fa84cb81ec3b997e039b84cca21852abaf4ff61780b99c47f1fd6ce64ae61f61b2458ca2929e068644f1973a6f1c53a4d64 CVE-2020-0570.patch" +b5973799d6dc7c03124b7df5424e5fa84cb81ec3b997e039b84cca21852abaf4ff61780b99c47f1fd6ce64ae61f61b2458ca2929e068644f1973a6f1c53a4d64 CVE-2020-0570.patch +47b2973561965e3ef906f03480b3877ad0018f32d31fecb4c410abe22c68ccad7d232cfe68804b70111616e15b979fb26642225b984d8fdbfc6cf6899ad63a0d section-header.patch" diff --git a/user/qt5-qtbase/section-header.patch b/user/qt5-qtbase/section-header.patch new file mode 100644 index 000000000..20664104a --- /dev/null +++ b/user/qt5-qtbase/section-header.patch @@ -0,0 +1,95 @@ +From ba6e0e4aac4d06782325c7032c8ea475f2d3eab0 Mon Sep 17 00:00:00 2001 +From: David Faure +Date: Sat, 13 Apr 2019 19:37:37 +0200 +Subject: [PATCH 1/1] QHeaderView: fix assert when restoring section sizes over + less columns +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf8 +Content-Transfer-Encoding: 8bit + +If columns are removed and we get notified via layoutChanged, the code +tries to restore old section sizes, and went out of bounds, leading to +an assert in QVector. Simply add an if() to skip restoring out-of-bounds columns. + +This comes from https://bugs.kde.org/show_bug.cgi?id=395181, +which translates into the unittest that is part of this commit. + +Change-Id: Ide42176a758f87b21957c40508127d67f1d5a2d9 +Reviewed-by: Christian Ehrlicher +Reviewed-by: Thorbjørn Lund Martsum +--- + src/widgets/itemviews/qheaderview.cpp | 16 +++++++++------- + .../widgets/itemviews/qheaderview/tst_qheaderview.cpp | 17 +++++++++++++++++ + 2 files changed, 26 insertions(+), 7 deletions(-) + +diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp +index 62abf567511..99309633a7b 100644 +--- a/src/widgets/itemviews/qheaderview.cpp ++++ b/src/widgets/itemviews/qheaderview.cpp +@@ -2283,13 +2283,15 @@ void QHeaderViewPrivate::_q_sectionsChanged(const QList & + : index.row()); + // the new visualIndices are already adjusted / reset by initializeSections() + const int newVisualIndex = visualIndex(newLogicalIndex); +- auto &newSection = sectionItems[newVisualIndex]; +- newSection = item.section; +- +- if (newSection.isHidden) { +- // otherwise setSectionHidden will return without doing anything +- newSection.isHidden = false; +- q->setSectionHidden(newLogicalIndex, true); ++ if (newVisualIndex < sectionItems.count()) { ++ auto &newSection = sectionItems[newVisualIndex]; ++ newSection = item.section; ++ ++ if (newSection.isHidden) { ++ // otherwise setSectionHidden will return without doing anything ++ newSection.isHidden = false; ++ q->setSectionHidden(newLogicalIndex, true); ++ } + } + } + +diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +index eaf75e74945..1b3e1e1f34e 100644 +--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp ++++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +@@ -248,6 +248,7 @@ private slots: + void sizeHintCrash(); + void testResetCachedSizeHint(); + void statusTips(); ++ void testRemovingColumnsViaLayoutChanged(); + + protected: + void setupTestData(bool use_reset_model = false); +@@ -353,6 +354,7 @@ public: + + void cleanup() + { ++ emit layoutAboutToBeChanged(); + cols = 3; + rows = 3; + emit layoutChanged(); +@@ -3489,5 +3491,20 @@ void tst_QHeaderView::statusTips() + QCOMPARE(headerView.statusTipText, QLatin1String("[0,1,0] -- Header")); + } + ++void tst_QHeaderView::testRemovingColumnsViaLayoutChanged() ++{ ++ const int persistentSectionSize = 101; ++ ++ QtTestModel model; ++ model.rows = model.cols = 5; ++ view->setModel(&model); ++ for (int i = 0; i < model.cols; ++i) ++ view->resizeSection(i, persistentSectionSize + i); ++ model.cleanup(); // down to 3 via layoutChanged (not columnsRemoved) ++ for (int j = 0; j < model.cols; ++j) ++ QCOMPARE(view->sectionSize(j), persistentSectionSize + j); ++ // The main point of this test is that the section-size restoring code didn't go out of bounds. ++} ++ + QTEST_MAIN(tst_QHeaderView) + #include "tst_qheaderview.moc" +-- +2.16.3 + -- cgit v1.2.3-70-g09d2