From 64a47714b9122411215682ca186f6c7c1f106818 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Wed, 17 Nov 2021 12:15:40 -0600 Subject: [PATCH] sync kde/5.15 branch fixes --- ...nimation-close-potential-memory-leak.patch | 58 +++++++++++++++++++ ...odel-Fix-out-of-bounds-cache-removal.patch | 30 ++++++++++ ...-t-leak-old-screenChanged-connection.patch | 50 ++++++++++++++++ qt5-qtdeclarative.spec | 8 ++- 4 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 0037-QQuickItemAnimation-close-potential-memory-leak.patch create mode 100644 0038-qqmldelegatemodel-Fix-out-of-bounds-cache-removal.patch create mode 100644 0039-QQuickWindow-don-t-leak-old-screenChanged-connection.patch diff --git a/0037-QQuickItemAnimation-close-potential-memory-leak.patch b/0037-QQuickItemAnimation-close-potential-memory-leak.patch new file mode 100644 index 0000000..54c9c28 --- /dev/null +++ b/0037-QQuickItemAnimation-close-potential-memory-leak.patch @@ -0,0 +1,58 @@ +From 8e85afd011ea25eec0aa710481e2474dbaaee869 Mon Sep 17 00:00:00 2001 +From: Volker Hilsheimer +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 +(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 data(new QQuickParentAnimationData); ++ std::unique_ptr 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 + diff --git a/0038-qqmldelegatemodel-Fix-out-of-bounds-cache-removal.patch b/0038-qqmldelegatemodel-Fix-out-of-bounds-cache-removal.patch new file mode 100644 index 0000000..661cb22 --- /dev/null +++ b/0038-qqmldelegatemodel-Fix-out-of-bounds-cache-removal.patch @@ -0,0 +1,30 @@ +From fe8c06d78a1b2f261806797c6f15f313cc3fc490 Mon Sep 17 00:00:00 2001 +From: Maximilian Goldstein +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 +(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 + diff --git a/0039-QQuickWindow-don-t-leak-old-screenChanged-connection.patch b/0039-QQuickWindow-don-t-leak-old-screenChanged-connection.patch new file mode 100644 index 0000000..fb005d4 --- /dev/null +++ b/0039-QQuickWindow-don-t-leak-old-screenChanged-connection.patch @@ -0,0 +1,50 @@ +From d7ede3462d7e12e4fa60a6efa1b83e2157be4b00 Mon Sep 17 00:00:00 2001 +From: Andreas Hartmetz +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 +Reviewed-by: Shawn Rutledge +(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 + diff --git a/qt5-qtdeclarative.spec b/qt5-qtdeclarative.spec index c82decb..993d5d6 100644 --- a/qt5-qtdeclarative.spec +++ b/qt5-qtdeclarative.spec @@ -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 - 5.15.2-10 +- sync kde/5.15 branch fixes + * Sat Oct 30 2021 Rex Dieter - 5.15.2-9 - sync kde/5.15 branch fixes