sync kde/5.15 branch fixes

This commit is contained in:
Rex Dieter 2021-11-17 12:15:40 -06:00
parent 6233f0bc2e
commit 64a47714b9
4 changed files with 145 additions and 1 deletions

View File

@ -0,0 +1,58 @@
From 8e85afd011ea25eec0aa710481e2474dbaaee869 Mon Sep 17 00:00:00 2001
From: Volker Hilsheimer <volker.hilsheimer@qt.io>
Date: Wed, 17 Mar 2021 16:52:21 +0100
Subject: [PATCH 37/41] QQuickItemAnimation: close potential memory leak
Fix static analyzer warning bff6cb4333f531d5a72f7bf6dc1485f6.
If ownership of viaData is not passed to the viaAction, then the object
might be leaked. Use std::unique_ptr to make ownership transfer explicit
and implicitly delete unowned objects.
Pick-to: 6.1 5.15
Change-Id: I89f2a6b630941a98a74db302bc1ab08055c71974
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 78aea267209c34abeb4895712dc76c923aa46165)
---
src/quick/items/qquickitemanimation.cpp | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp
index 23694e2de3..dfb56ccc00 100644
--- a/src/quick/items/qquickitemanimation.cpp
+++ b/src/quick/items/qquickitemanimation.cpp
@@ -230,8 +230,8 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act
{
Q_D(QQuickParentAnimation);
- QQuickParentAnimationData *data = new QQuickParentAnimationData;
- QQuickParentAnimationData *viaData = new QQuickParentAnimationData;
+ std::unique_ptr<QQuickParentAnimationData> data(new QQuickParentAnimationData);
+ std::unique_ptr<QQuickParentAnimationData> viaData(new QQuickParentAnimationData);
bool hasExplicit = false;
if (d->target && d->newParent) {
@@ -377,8 +377,8 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act
QParallelAnimationGroupJob *ag = new QParallelAnimationGroupJob;
if (d->via)
- viaAction->setAnimAction(viaData);
- targetAction->setAnimAction(data);
+ viaAction->setAnimAction(viaData.release());
+ targetAction->setAnimAction(data.release());
//take care of any child animations
bool valid = d->defaultProperty.isValid();
@@ -405,9 +405,6 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act
topLevelGroup->appendAnimation(d->via ? viaAction : targetAction);
}
return initInstance(topLevelGroup);
- } else {
- delete data;
- delete viaData;
}
return nullptr;
}
--
2.33.1

View File

@ -0,0 +1,30 @@
From fe8c06d78a1b2f261806797c6f15f313cc3fc490 Mon Sep 17 00:00:00 2001
From: Maximilian Goldstein <max.goldstein@qt.io>
Date: Tue, 23 Feb 2021 16:10:44 +0100
Subject: [PATCH 38/41] qqmldelegatemodel: Fix out of bounds cache removal
Pick-to: 5.15 6.0 6.1
Task-number: QTBUG-91276
Change-Id: I1ddbb4a3326d61ff94e3881beb64a14dade11c46
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 31ad81d81e623a34cd71567b9507f16601f1c1d4)
---
src/qmlmodels/qqmldelegatemodel.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp
index 8ce3da1cf1..8a74a854f4 100644
--- a/src/qmlmodels/qqmldelegatemodel.cpp
+++ b/src/qmlmodels/qqmldelegatemodel.cpp
@@ -1621,7 +1621,7 @@ void QQmlDelegateModelPrivate::itemsRemoved(
removed[i] = 0;
for (const Compositor::Remove &remove : removes) {
- for (; cacheIndex < remove.cacheIndex; ++cacheIndex)
+ for (; cacheIndex < remove.cacheIndex && cacheIndex < m_cache.size(); ++cacheIndex)
incrementIndexes(m_cache.at(cacheIndex), m_groupCount, removed);
for (int i = 1; i < m_groupCount; ++i) {
--
2.33.1

View File

@ -0,0 +1,50 @@
From d7ede3462d7e12e4fa60a6efa1b83e2157be4b00 Mon Sep 17 00:00:00 2001
From: Andreas Hartmetz <andreas@ixgreen.de>
Date: Fri, 5 Mar 2021 12:41:06 +0100
Subject: [PATCH 39/41] QQuickWindow: don't leak old screenChanged connections
Connections could accumulate. Because the newest one was invoked
last due to how signal-slot invocations are ordered, rendering
was correct, but the stale connections caused unnecessary updates
(and wasted a small amount of memory).
This comes from a misunderstanding I had at the time about how
QMetaObject::Connection works. Destroying or overwriting one does
not affect the actual connection.
While at it, also modernize the connect().
Pick-to: 5.15 6.0 6.1
Change-Id: Idde81bdbff8947ed517bf2740d623a395c0acb74
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 9f8292d48913c5bc50377749c2b3e030cf16d703)
---
src/quick/items/qquickwindow.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 9ff91eb9a0..fbb807ca96 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -450,15 +450,14 @@ void QQuickWindow::physicalDpiChanged()
void QQuickWindow::handleScreenChanged(QScreen *screen)
{
Q_D(QQuickWindow);
+ disconnect(d->physicalDpiChangedConnection);
if (screen) {
physicalDpiChanged();
// When physical DPI changes on the same screen, either the resolution or the device pixel
// ratio changed. We must check what it is. Device pixel ratio does not have its own
// ...Changed() signal.
- d->physicalDpiChangedConnection = connect(screen, SIGNAL(physicalDotsPerInchChanged(qreal)),
- this, SLOT(physicalDpiChanged()));
- } else {
- disconnect(d->physicalDpiChangedConnection);
+ d->physicalDpiChangedConnection = connect(screen, &QScreen::physicalDotsPerInchChanged,
+ this, &QQuickWindow::physicalDpiChanged);
}
d->forcePolish();
--
2.33.1

View File

@ -8,7 +8,7 @@
Summary: Qt5 - QtDeclarative component
Name: qt5-%{qt_module}
Version: 5.15.2
Release: 9%{?dist}
Release: 10%{?dist}
# See LICENSE.GPL LICENSE.LGPL LGPL_EXCEPTION.txt, for details
License: LGPLv2 with exceptions or GPLv3 with exceptions
@ -61,6 +61,9 @@ Patch33: 0033-Fix-sweep-step-for-tainted-QObject-JavaScript-wrappe.patch
Patch34: 0034-Fix-distorted-text-with-subpixel-matrix-translation.patch
Patch35: 0035-Revert-Fix-for-possible-crash-in-QSGDefaultLayer-gra.patch
Patch36: 0036-Do-not-revert-properties-of-deleted-objects.patch
Patch37: 0037-QQuickItemAnimation-close-potential-memory-leak.patch
Patch38: 0038-qqmldelegatemodel-Fix-out-of-bounds-cache-removal.patch
Patch39: 0039-QQuickWindow-don-t-leak-old-screenChanged-connection.patch
## upstreamable patches
Patch100: %{name}-gcc11.patch
@ -243,6 +246,9 @@ make check -k -C tests ||:
%changelog
* Wed Nov 17 2021 Rex Dieter <rdieter@fedoraproject.org> - 5.15.2-10
- sync kde/5.15 branch fixes
* Sat Oct 30 2021 Rex Dieter <rdieter@fedoraproject.org> - 5.15.2-9
- sync kde/5.15 branch fixes