public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Andreas Sturmlechner" <asturm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: kde-frameworks/knewstuff/, kde-frameworks/knewstuff/files/
Date: Sat, 19 Dec 2020 23:36:59 +0000 (UTC)	[thread overview]
Message-ID: <1608421010.e8191b8cfc11a02c4f9a65e64daf04b4bba5039b.asturm@gentoo> (raw)

commit:     e8191b8cfc11a02c4f9a65e64daf04b4bba5039b
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 19 23:21:54 2020 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Dec 19 23:36:50 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e8191b8c

kde-frameworks/knewstuff: Add upstream crashfix

Upstream commit 243ea6155b28457c8b1441fee8ab1037828d21ba

See also: https://mail.kde.org/pipermail/distributions/2020-December/000910.html
KDE-bug: https://bugs.kde.org/show_bug.cgi?id=429442
Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../files/knewstuff-5.77.0-add-dptr-to-cache.patch | 135 +++++++++++++++++++++
 .../knewstuff/knewstuff-5.77.0-r1.ebuild           |  42 +++++++
 2 files changed, 177 insertions(+)

diff --git a/kde-frameworks/knewstuff/files/knewstuff-5.77.0-add-dptr-to-cache.patch b/kde-frameworks/knewstuff/files/knewstuff-5.77.0-add-dptr-to-cache.patch
new file mode 100644
index 00000000000..f6547fc6e5f
--- /dev/null
+++ b/kde-frameworks/knewstuff/files/knewstuff-5.77.0-add-dptr-to-cache.patch
@@ -0,0 +1,135 @@
+From 243ea6155b28457c8b1441fee8ab1037828d21ba Mon Sep 17 00:00:00 2001
+From: Dan Leinir Turthra Jensen <admin@leinir.dk>
+Date: Mon, 14 Dec 2020 21:11:51 +0000
+Subject: [PATCH] Add a dptr to Cache, and move the throttle timer there to fix
+ crash
+
+Previously, the throttle timer was a raw static, but it was also a parented qobject, which means that when the cache was deleted, so was the timer, but the variable was not reset. Consequently, things would crash left and right later on. So, to alleviate this, and hopefully avoid future issues, introduce a dptr, stick the timer there, and move the logic to that private class as well.
+
+BUG:429442
+
+FIXED-IN:5.78
+---
+ src/core/cache.cpp | 41 ++++++++++++++++++++++++++++++-----------
+ src/core/cache.h   |  7 +++++--
+ 2 files changed, 35 insertions(+), 13 deletions(-)
+
+diff --git a/src/core/cache.cpp b/src/core/cache.cpp
+index 0395045c..ace7be4e 100644
+--- a/src/core/cache.cpp
++++ b/src/core/cache.cpp
+@@ -11,17 +11,42 @@
+ #include <QDir>
+ #include <QFileInfo>
+ #include <QFileSystemWatcher>
++#include <QPointer>
+ #include <QTimer>
+ #include <QXmlStreamReader>
+ #include <qstandardpaths.h>
+ #include <knewstuffcore_debug.h>
+ 
++class KNSCore::CachePrivate {
++public:
++    CachePrivate(Cache* qq)
++        : q(qq)
++    {}
++    ~CachePrivate() {}
++
++    Cache* q;
++    QHash<QString, EntryInternal::List> requestCache;
++
++    QPointer<QTimer> throttleTimer;
++    void throttleWrite() {
++        if (!throttleTimer) {
++            throttleTimer = new QTimer(q);
++            QObject::connect(throttleTimer, &QTimer::timeout, q, [this](){ q->writeRegistry(); });
++            throttleTimer->setSingleShot(true);
++            throttleTimer->setInterval(1000);
++        }
++        throttleTimer->start();
++    }
++};
++
+ using namespace KNSCore;
+ 
+ typedef QHash<QString, QWeakPointer<Cache> > CacheHash;
+ Q_GLOBAL_STATIC(CacheHash, s_caches)
+ 
+-Cache::Cache(const QString &appName): QObject(nullptr)
++Cache::Cache(const QString &appName)
++    : QObject(nullptr)
++    , d(new CachePrivate(this))
+ {
+     m_kns2ComponentName = appName;
+ 
+@@ -280,36 +305,30 @@ void Cache::registerChangedEntry(const KNSCore::EntryInternal &entry)
+     if (entry.status() == KNS3::Entry::Updating || entry.status() == KNS3::Entry::Installing) {
+         return;
+     }
+-    static QTimer* writeThrottle{nullptr};
+-    if (!writeThrottle) {
+-        writeThrottle = new QTimer(this);
+-        connect(writeThrottle, &QTimer::timeout, this, [this](){ writeRegistry(); });
+-        writeThrottle->setInterval(1000);
+-    }
+     if (!property("reloadingRegistry").toBool()) {
+         setProperty("dirty", true);
+         cache.remove(entry); // If value already exists in the set, the set is left unchanged
+         cache.insert(entry);
+-        writeThrottle->start();
++        d->throttleWrite();
+     }
+ }
+ 
+ void Cache::insertRequest(const KNSCore::Provider::SearchRequest &request, const KNSCore::EntryInternal::List &entries)
+ {
+     // append new entries
+-    auto &cacheList = requestCache[request.hashForRequest()];
++    auto &cacheList = d->requestCache[request.hashForRequest()];
+     for (const auto &entry : entries) {
+         if (!cacheList.contains(entry)) {
+             cacheList.append(entry);
+         }
+     }
+-    qCDebug(KNEWSTUFFCORE) << request.hashForRequest() << " add: " << entries.size() << " keys: " << requestCache.keys();
++    qCDebug(KNEWSTUFFCORE) << request.hashForRequest() << " add: " << entries.size() << " keys: " << d->requestCache.keys();
+ }
+ 
+ EntryInternal::List Cache::requestFromCache(const KNSCore::Provider::SearchRequest &request)
+ {
+     qCDebug(KNEWSTUFFCORE) << request.hashForRequest();
+-    return requestCache.value(request.hashForRequest());
++    return d->requestCache.value(request.hashForRequest());
+ }
+ 
+ void KNSCore::Cache::removeDeletedEntries()
+diff --git a/src/core/cache.h b/src/core/cache.h
+index 06e95ab4..73ea7c61 100644
+--- a/src/core/cache.h
++++ b/src/core/cache.h
+@@ -16,9 +16,11 @@
+ 
+ #include "knewstuffcore_export.h"
+ 
++#include <memory.h>
++
+ namespace KNSCore
+ {
+-
++class CachePrivate;
+ class KNEWSTUFFCORE_EXPORT Cache : public QObject
+ {
+     Q_OBJECT
+@@ -99,7 +101,8 @@ private:
+     QString m_kns2ComponentName;
+ 
+     QSet<EntryInternal> cache;
+-    QHash<QString, EntryInternal::List> requestCache;
++
++    std::unique_ptr<CachePrivate> d;
+ };
+ 
+ }
+-- 
+GitLab
+

diff --git a/kde-frameworks/knewstuff/knewstuff-5.77.0-r1.ebuild b/kde-frameworks/knewstuff/knewstuff-5.77.0-r1.ebuild
new file mode 100644
index 00000000000..59ba609ab98
--- /dev/null
+++ b/kde-frameworks/knewstuff/knewstuff-5.77.0-r1.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+ECM_TEST="false"
+PVCUT=$(ver_cut 1-2)
+QTMIN=5.15.1
+inherit ecm kde.org
+
+DESCRIPTION="Framework for downloading and sharing additional application data"
+
+LICENSE="LGPL-2+"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
+IUSE=""
+
+DEPEND="
+	>=dev-qt/qtdeclarative-${QTMIN}:5
+	>=dev-qt/qtgui-${QTMIN}:5
+	>=dev-qt/qtnetwork-${QTMIN}:5
+	>=dev-qt/qtwidgets-${QTMIN}:5
+	>=dev-qt/qtxml-${QTMIN}:5
+	=kde-frameworks/attica-${PVCUT}*:5
+	=kde-frameworks/karchive-${PVCUT}*:5
+	=kde-frameworks/kcompletion-${PVCUT}*:5
+	=kde-frameworks/kconfig-${PVCUT}*:5
+	=kde-frameworks/kcoreaddons-${PVCUT}*:5
+	=kde-frameworks/ki18n-${PVCUT}*:5
+	=kde-frameworks/kiconthemes-${PVCUT}*:5
+	=kde-frameworks/kio-${PVCUT}*:5
+	=kde-frameworks/kitemviews-${PVCUT}*:5
+	=kde-frameworks/kpackage-${PVCUT}*:5
+	=kde-frameworks/kservice-${PVCUT}*:5
+	=kde-frameworks/ktextwidgets-${PVCUT}*:5
+	=kde-frameworks/kwidgetsaddons-${PVCUT}*:5
+	=kde-frameworks/kxmlgui-${PVCUT}*:5
+"
+RDEPEND="${DEPEND}
+	>=kde-frameworks/kirigami-${PVCUT}:5
+"
+
+PATCHES=( "${FILESDIR}/${P}-add-dptr-to-cache.patch" ) # KDE-bug 429442


             reply	other threads:[~2020-12-19 23:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-19 23:36 Andreas Sturmlechner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-09-29  8:08 [gentoo-commits] repo/gentoo:master commit in: kde-frameworks/knewstuff/, kde-frameworks/knewstuff/files/ Andreas Sturmlechner
2021-10-11 11:01 Andreas Sturmlechner
2022-05-30 16:09 Andreas Sturmlechner
2022-06-14  7:44 Andreas Sturmlechner
2023-01-30 21:43 Andreas Sturmlechner
2024-07-16 21:41 Andreas Sturmlechner
2024-08-10  7:57 Andreas Sturmlechner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1608421010.e8191b8cfc11a02c4f9a65e64daf04b4bba5039b.asturm@gentoo \
    --to=asturm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox