Skip to content

Commit 6ee3a62

Browse files
add Qt 5.15.x patches from KDE
generated from a72077a88903fe532f6a749677eb4da4ea99f79f except: 0018-Fix-memory-leak 0024-Use-icon-themes-in-QPrintPreviewDialog-if-they-exist 0061-Annotate-QMutex-with-TSAN-annotations
1 parent fa1f593 commit 6ee3a62

File tree

128 files changed

+50111
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+50111
-0
lines changed

conan_patches/qt/conandata.yml

Lines changed: 252 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
From cc3cfd006594231f3f8e13325305fe0300a4bec5 Mon Sep 17 00:00:00 2001
2+
From: ChunLin Wang <[email protected]>
3+
Date: Wed, 31 Mar 2021 17:54:49 +0800
4+
Subject: [PATCH 001/130] Fix get out of bounds index in
5+
QSortFilterProxyModel::filterAcceptsRow
6+
7+
Before calling the index function, we need to check the validity of the parameters.
8+
9+
Fixes: QTBUG-91878
10+
Change-Id: I9ec7265fff3f81b8a288c4ba8fae606a2ec808a6
11+
Reviewed-by: David Faure <[email protected]>
12+
(cherry picked from commit b8802071ed00689373da5817fc4824a30b5fcf86)
13+
(cherry picked from commit 0a5326a6c292df9cda313e0dcbe75f69f2f7072d)
14+
---
15+
.../itemmodels/qsortfilterproxymodel.cpp | 8 +++++---
16+
.../tst_qconcatenatetablesproxymodel.cpp | 17 +++++++++++++++++
17+
2 files changed, 22 insertions(+), 3 deletions(-)
18+
19+
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
20+
index 3d7fe43cd3f..ce35bda5e11 100644
21+
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
22+
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
23+
@@ -3131,8 +3131,9 @@ bool QSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &
24+
25+
if (d->filter_data.isEmpty())
26+
return true;
27+
+
28+
+ int column_count = d->model->columnCount(source_parent);
29+
if (d->filter_column == -1) {
30+
- int column_count = d->model->columnCount(source_parent);
31+
for (int column = 0; column < column_count; ++column) {
32+
QModelIndex source_index = d->model->index(source_row, column, source_parent);
33+
QString key = d->model->data(source_index, d->filter_role).toString();
34+
@@ -3141,9 +3142,10 @@ bool QSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &
35+
}
36+
return false;
37+
}
38+
- QModelIndex source_index = d->model->index(source_row, d->filter_column, source_parent);
39+
- if (!source_index.isValid()) // the column may not exist
40+
+
41+
+ if (d->filter_column >= column_count) // the column may not exist
42+
return true;
43+
+ QModelIndex source_index = d->model->index(source_row, d->filter_column, source_parent);
44+
QString key = d->model->data(source_index, d->filter_role).toString();
45+
return d->filter_data.hasMatch(key);
46+
}
47+
diff --git a/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp b/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp
48+
index e1ea7a45525..90972caa575 100644
49+
--- a/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp
50+
+++ b/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp
51+
@@ -117,6 +117,7 @@ private Q_SLOTS:
52+
void shouldPropagateDropAfterLastRow_data();
53+
void shouldPropagateDropAfterLastRow();
54+
void qtbug91788();
55+
+ void qtbug91878();
56+
57+
private:
58+
QStandardItemModel mod;
59+
@@ -843,6 +844,22 @@ void tst_QConcatenateTablesProxyModel::qtbug91788()
60+
QCOMPARE(proxyConcat.columnCount(), 0);
61+
}
62+
63+
+void tst_QConcatenateTablesProxyModel::qtbug91878()
64+
+{
65+
+ QStandardItemModel m;
66+
+ m.setRowCount(4);
67+
+ m.setColumnCount(4);
68+
+
69+
+ QConcatenateTablesProxyModel pm;
70+
+ QSortFilterProxyModel proxyFilter;
71+
+ proxyFilter.setSourceModel(&pm);
72+
+ proxyFilter.setFilterFixedString("something");
73+
+ pm.addSourceModel(&m); // This should not assert
74+
+
75+
+ QCOMPARE(pm.columnCount(), 4);
76+
+ QCOMPARE(pm.rowCount(), 4);
77+
+}
78+
+
79+
QTEST_GUILESS_MAIN(tst_QConcatenateTablesProxyModel)
80+
81+
#include "tst_qconcatenatetablesproxymodel.moc"
82+
--
83+
2.39.5 (Apple Git-154)
84+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
From a0143b653f6dec495303a4dba3d019384e1f4657 Mon Sep 17 00:00:00 2001
2+
From: Edward Welbourne <[email protected]>
3+
Date: Mon, 8 Feb 2021 12:13:13 +0100
4+
Subject: [PATCH 002/130] Fix handling of surrogates in QBidiAlgorithm
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
Prior code was naively assuming the character after a high surrogate
10+
would necessarily be a low surrogate, which is buggy.
11+
Fixes oss-fuzz issue 29718.
12+
13+
Pick-to: 6.0 6.1 5.15
14+
Change-Id: I10f023c4b5024a0d76fea0a3672001063591ec6d
15+
Reviewed-by: Konstantin Ritt <[email protected]>
16+
Reviewed-by: Robert Löhning <[email protected]>
17+
Reviewed-by: Lars Knoll <[email protected]>
18+
(cherry picked from commit aeeaab1a5ac0b4d91c9f9b542035b8970e4c61dd)
19+
---
20+
src/gui/text/qtextengine.cpp | 2 +-
21+
1 file changed, 1 insertion(+), 1 deletion(-)
22+
23+
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
24+
index 6336fadf749..a6c66e5d2dc 100644
25+
--- a/src/gui/text/qtextengine.cpp
26+
+++ b/src/gui/text/qtextengine.cpp
27+
@@ -1,6 +1,6 @@
28+
/****************************************************************************
29+
**
30+
-** Copyright (C) 2016 The Qt Company Ltd.
31+
+** Copyright (C) 2021 The Qt Company Ltd.
32+
** Contact: https://www.qt.io/licensing/
33+
**
34+
** This file is part of the QtGui module of the Qt Toolkit.
35+
--
36+
2.39.5 (Apple Git-154)
37+
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
From 11897b39598875f367311f87949332b3f028c4cf Mon Sep 17 00:00:00 2001
2+
From: Ilya Fedin <[email protected]>
3+
Date: Mon, 12 Apr 2021 12:09:59 +0400
4+
Subject: [PATCH 003/130] Don't own unique name for QDBusTrayIcon
5+
6+
Flatpak doesn't allow to own random name with PID. Even after adding
7+
such a permission into manifest, all flatpaked apps have PID 2, so only
8+
one Qt application at a time can have tray icon.
9+
10+
Even though unique name is a part of the spec, no tray hosts really
11+
check it and SNI implementations without unique name run just fine
12+
inside and outside of Flatpak.
13+
14+
This fixes the inability of Qt applications to have tray icon in Flatpak
15+
outside of KDE.
16+
17+
Pick-to: 6.0 6.1 5.15
18+
Change-Id: Ieea6dc335b7a74537a51929f6e70ca68c84228fb
19+
Reviewed-by: Dmitry Shachnev <[email protected]>
20+
Reviewed-by: Shawn Rutledge <[email protected]>
21+
(cherry picked from commit 9db7cc79a26ced4997277b5c206ca15949133240)
22+
---
23+
.../dbusmenu/qdbusmenuconnection.cpp | 17 ++++-------------
24+
.../dbusmenu/qdbusmenuconnection_p.h | 2 +-
25+
2 files changed, 5 insertions(+), 14 deletions(-)
26+
27+
diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp
28+
index 09470bccc6c..345a853b1b7 100644
29+
--- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp
30+
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp
31+
@@ -105,13 +105,7 @@ void QDBusMenuConnection::unregisterTrayIconMenu(QDBusTrayIcon *item)
32+
33+
bool QDBusMenuConnection::registerTrayIcon(QDBusTrayIcon *item)
34+
{
35+
- bool success = connection().registerService(item->instanceId());
36+
- if (!success) {
37+
- qWarning() << "failed to register service" << item->instanceId();
38+
- return false;
39+
- }
40+
-
41+
- success = connection().registerObject(StatusNotifierItemPath, item);
42+
+ bool success = connection().registerObject(StatusNotifierItemPath, item);
43+
if (!success) {
44+
unregisterTrayIcon(item);
45+
qWarning() << "failed to register" << item->instanceId() << StatusNotifierItemPath;
46+
@@ -126,21 +120,18 @@ bool QDBusMenuConnection::registerTrayIcon(QDBusTrayIcon *item)
47+
48+
bool QDBusMenuConnection::registerTrayIconWithWatcher(QDBusTrayIcon *item)
49+
{
50+
+ Q_UNUSED(item);
51+
QDBusMessage registerMethod = QDBusMessage::createMethodCall(
52+
StatusNotifierWatcherService, StatusNotifierWatcherPath, StatusNotifierWatcherService,
53+
QLatin1String("RegisterStatusNotifierItem"));
54+
- registerMethod.setArguments(QVariantList() << item->instanceId());
55+
+ registerMethod.setArguments(QVariantList() << m_connection.baseService());
56+
return m_connection.callWithCallback(registerMethod, this, SIGNAL(trayIconRegistered()), SLOT(dbusError(QDBusError)));
57+
}
58+
59+
-bool QDBusMenuConnection::unregisterTrayIcon(QDBusTrayIcon *item)
60+
+void QDBusMenuConnection::unregisterTrayIcon(QDBusTrayIcon *item)
61+
{
62+
unregisterTrayIconMenu(item);
63+
connection().unregisterObject(StatusNotifierItemPath);
64+
- bool success = connection().unregisterService(item->instanceId());
65+
- if (!success)
66+
- qWarning() << "failed to unregister service" << item->instanceId();
67+
- return success;
68+
}
69+
#endif // QT_NO_SYSTEMTRAYICON
70+
71+
diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h
72+
index f484795fbb7..11c7e56534d 100644
73+
--- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h
74+
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h
75+
@@ -78,7 +78,7 @@ public:
76+
void unregisterTrayIconMenu(QDBusTrayIcon *item);
77+
bool registerTrayIcon(QDBusTrayIcon *item);
78+
bool registerTrayIconWithWatcher(QDBusTrayIcon *item);
79+
- bool unregisterTrayIcon(QDBusTrayIcon *item);
80+
+ void unregisterTrayIcon(QDBusTrayIcon *item);
81+
#endif // QT_NO_SYSTEMTRAYICON
82+
83+
Q_SIGNALS:
84+
--
85+
2.39.5 (Apple Git-154)
86+
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
From 1940e91c23aba5528e928ff1da68dda657178109 Mon Sep 17 00:00:00 2001
2+
From: Lars Knoll <[email protected]>
3+
Date: Fri, 4 Sep 2020 10:40:29 +0200
4+
Subject: [PATCH 004/130] Deprecate QMutex in recursive mode
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
Use QRecursiveMutex instead.
10+
11+
Pick-to: 5.15
12+
Change-Id: I862fc2b3143deeb5c96dc8d445be5f9fa2535670
13+
Reviewed-by: Volker Hilsheimer <[email protected]>
14+
Reviewed-by: Mårten Nordheim <[email protected]>
15+
(cherry picked from commit 0e681064b54a6873bef5ddb7edef7e2efc317efc)
16+
---
17+
src/corelib/thread/qmutex.cpp | 4 +++-
18+
src/corelib/thread/qmutex.h | 11 ++++++++---
19+
src/corelib/thread/qwaitcondition_unix.cpp | 2 +-
20+
3 files changed, 12 insertions(+), 5 deletions(-)
21+
22+
diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp
23+
index 310d1cb14f7..7097122d8e0 100644
24+
--- a/src/corelib/thread/qmutex.cpp
25+
+++ b/src/corelib/thread/qmutex.cpp
26+
@@ -152,6 +152,7 @@ public:
27+
28+
/*!
29+
\enum QMutex::RecursionMode
30+
+ \obsolete Use QRecursiveMutex to create a recursive mutex.
31+
32+
\value Recursive In this mode, a thread can lock the same mutex
33+
multiple times and the mutex won't be unlocked
34+
@@ -173,6 +174,7 @@ public:
35+
36+
/*!
37+
Constructs a new mutex. The mutex is created in an unlocked state.
38+
+ \obsolete Use QRecursiveMutex to create a recursive mutex.
39+
40+
If \a mode is QMutex::Recursive, a thread can lock the same mutex
41+
multiple times and the mutex won't be unlocked until a
42+
@@ -197,7 +199,7 @@ QMutex::QMutex(RecursionMode mode)
43+
QMutex::~QMutex()
44+
{
45+
QMutexData *d = d_ptr.loadRelaxed();
46+
- if (isRecursive()) {
47+
+ if (QBasicMutex::isRecursive()) {
48+
delete static_cast<QRecursiveMutexPrivate *>(d);
49+
} else if (d) {
50+
#ifndef QT_LINUX_FUTEX
51+
diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h
52+
index 73c9e006630..b2e2640ba2d 100644
53+
--- a/src/corelib/thread/qmutex.h
54+
+++ b/src/corelib/thread/qmutex.h
55+
@@ -134,8 +134,16 @@ public:
56+
#else
57+
QMutex() { d_ptr.storeRelaxed(nullptr); }
58+
#endif
59+
+#if QT_DEPRECATED_SINCE(5,15)
60+
enum RecursionMode { NonRecursive, Recursive };
61+
+ QT_DEPRECATED_VERSION_X(5, 15, "Use QRecursiveMutex instead of a recursive QMutex")
62+
explicit QMutex(RecursionMode mode);
63+
+
64+
+ QT_DEPRECATED_VERSION_X(5, 15, "Use QRecursiveMutex instead of a recursive QMutex")
65+
+ bool isRecursive() const noexcept
66+
+ { return QBasicMutex::isRecursive(); }
67+
+#endif
68+
+
69+
~QMutex();
70+
71+
// BasicLockable concept
72+
@@ -166,9 +174,6 @@ public:
73+
}
74+
#endif
75+
76+
- bool isRecursive() const noexcept
77+
- { return QBasicMutex::isRecursive(); }
78+
-
79+
private:
80+
Q_DISABLE_COPY(QMutex)
81+
friend class QMutexLocker;
82+
diff --git a/src/corelib/thread/qwaitcondition_unix.cpp b/src/corelib/thread/qwaitcondition_unix.cpp
83+
index 88b058f4101..0f1da4dc9b3 100644
84+
--- a/src/corelib/thread/qwaitcondition_unix.cpp
85+
+++ b/src/corelib/thread/qwaitcondition_unix.cpp
86+
@@ -213,7 +213,7 @@ bool QWaitCondition::wait(QMutex *mutex, QDeadlineTimer deadline)
87+
{
88+
if (! mutex)
89+
return false;
90+
- if (mutex->isRecursive()) {
91+
+ if (static_cast<QBasicMutex *>(mutex)->isRecursive()) {
92+
qWarning("QWaitCondition: cannot wait on recursive mutexes");
93+
return false;
94+
}
95+
--
96+
2.39.5 (Apple Git-154)
97+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
From 5761fc24f3cf015428dd4816800e3142e44a6b8d Mon Sep 17 00:00:00 2001
2+
From: Luca Beldi <[email protected]>
3+
Date: Fri, 23 Apr 2021 15:35:29 +0100
4+
Subject: [PATCH 005/130] Fix QAbstractItemModelTester false positive
5+
6+
When inserting rows to a branch with no columns
7+
the tester should not complain about indexes being invalid
8+
9+
Pick-to: 6.1 6.0 5.15
10+
Change-Id: I466f4e5140b10f6dcf65a71f109c2d3be7336507
11+
Reviewed-by: David Faure <[email protected]>
12+
(cherry picked from commit fcea8e7aa8a65de9e80136c2d603478831b246d0)
13+
---
14+
src/testlib/qabstractitemmodeltester.cpp | 2 +-
15+
.../qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp | 4 ++++
16+
2 files changed, 5 insertions(+), 1 deletion(-)
17+
18+
diff --git a/src/testlib/qabstractitemmodeltester.cpp b/src/testlib/qabstractitemmodeltester.cpp
19+
index 1cd18b98bbc..41219a7e233 100644
20+
--- a/src/testlib/qabstractitemmodeltester.cpp
21+
+++ b/src/testlib/qabstractitemmodeltester.cpp
22+
@@ -454,7 +454,7 @@ void QAbstractItemModelTesterPrivate::parent()
23+
24+
// Common error test #2, make sure that a second level index has a parent
25+
// that is the first level index.
26+
- if (model->rowCount(topIndex) > 0) {
27+
+ if (model->rowCount(topIndex) > 0 && model->columnCount(topIndex) > 0) {
28+
QModelIndex childIndex = model->index(0, 0, topIndex);
29+
MODELTESTER_VERIFY(childIndex.isValid());
30+
MODELTESTER_COMPARE(model->parent(childIndex), topIndex);
31+
diff --git a/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp b/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp
32+
index f6ad97a96be..61452dceaed 100644
33+
--- a/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp
34+
+++ b/tests/auto/testlib/qabstractitemmodeltester/tst_qabstractitemmodeltester.cpp
35+
@@ -116,6 +116,10 @@ void tst_QAbstractItemModelTester::standardItemModelZeroColumns()
36+
// QTBUG-92886
37+
model.insertRows(0, 5);
38+
model.removeRows(1, 2);
39+
+
40+
+ const QModelIndex parentIndex = model.index(0, 0);
41+
+ model.insertRows(0, 5, parentIndex);
42+
+ model.removeRows(1, 2, parentIndex);
43+
}
44+
45+
void tst_QAbstractItemModelTester::testInsertThroughProxy()
46+
--
47+
2.39.5 (Apple Git-154)
48+

0 commit comments

Comments
 (0)