[plasma/discover/Plasma/6.7] libdiscover/UpdateModel: UpdateModel: Do not pass a lambda to a unique connect
Aleix Pol Gonzalez <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 3c4a9ac934d92f315e50636a1ab945fc84c6f589 by Aleix Pol Gonzalez. Committed on 28/07/2026 at 13:13. Pushed by apol into branch 'Plasma/6.7'. UpdateModel: Do not pass a lambda to a unique connect It doesn't like it. (cherry picked from commit a50f46fba9f43a60352c0968eb175f22e4532af4) Co-authored-by: Aleix Pol <[email protected]> M +6 -8 libdiscover/UpdateModel/UpdateModel.cpp M +1 -0 libdiscover/UpdateModel/UpdateModel.h https://invent.kde.org/plasma/discover/-/commit/3c4a9ac934d92f315e50636a1ab945fc84c6f589 diff --git a/libdiscover/UpdateModel/UpdateModel.cpp b/libdiscover/UpdateModel/UpdateModel.cpp index de409275e..04634c5b6 100644 --- a/libdiscover/UpdateModel/UpdateModel.cpp +++ b/libdiscover/UpdateModel/UpdateModel.cpp @@ -249,14 +249,7 @@ void UpdateModel::setResources(const QList<AbstractResource *> &resources) } m_resources = resources; for (auto resource : std::as_const(resources)) { - connect( - resource, - &QObject::destroyed, - this, - [this, resource] { - m_resources.removeAll(resource); - }, - Qt::UniqueConnection); + connect(resource, &QObject::destroyed, this, &UpdateModel::resourceDestroyed, Qt::UniqueConnection); } beginResetModel(); @@ -311,6 +304,11 @@ void UpdateModel::setResources(const QList<AbstractResource *> &resources) Q_EMIT toUpdateChanged(); } +void UpdateModel::resourceDestroyed(QObject *resource) +{ + m_resources.removeAll(resource); +} + bool UpdateModel::hasUpdates() const { return rowCount() > 0; diff --git a/libdiscover/UpdateModel/UpdateModel.h b/libdiscover/UpdateModel/UpdateModel.h index 9654dded1..4a5d2e691 100644 --- a/libdiscover/UpdateModel/UpdateModel.h +++ b/libdiscover/UpdateModel/UpdateModel.h @@ -82,6 +82,7 @@ private: QModelIndex indexFromResource(AbstractResource *res) const; void resourceHasProgressed(AbstractResource *res, qreal progress, AbstractBackendUpdater::State state); void activityChanged(); + void resourceDestroyed(QObject *resource); QTimer *const m_updateSizeTimer; QVector<UpdateItem *> m_updateItems;