Accepting request 1068413 from KDE:Frameworks5

- Apply important fixes from the 5.27 branch:
  * 0001-Expose-FlatpakReferencesModel-to-QML.patch
  * 0002-Avoid-duplicating-connections-between-ref-and-its-re.patch
  * 0003-Port-from-NULL-to-nullptr.patch
  * 0004-Fix-GLib-memory-management-issue.patch (forwarded request 1068360 from Vogtinator)

OBS-URL: https://build.opensuse.org/request/show/1068413
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kcm_flatpak?expand=0&rev=4
This commit is contained in:
Dominique Leuenberger 2023-03-02 22:02:46 +00:00 committed by Git OBS Bridge
commit 60fd0dcc2d
10 changed files with 221 additions and 20 deletions

View File

@ -0,0 +1,42 @@
From 7315348966666340557f61bb0f25b3c9dc3a9f29 Mon Sep 17 00:00:00 2001
From: ivan tkachenko <me@ratijas.tk>
Date: Tue, 7 Feb 2023 03:01:38 +0300
Subject: [PATCH 1/4] Expose FlatpakReferencesModel to QML
We'll be needing its enum values soon, to request model data by role.
(cherry picked from commit fc64ff4b8cc2f285ca99dc9d311d299b66780a95)
This was actually required for 03f195ea353f0ca522e49aacc76eb74612d2d653.
---
flatpakreference.h | 1 +
kcm.cpp | 1 +
2 files changed, 2 insertions(+)
diff --git a/flatpakreference.h b/flatpakreference.h
index cc5d5e7..3a78878 100644
--- a/flatpakreference.h
+++ b/flatpakreference.h
@@ -66,6 +66,7 @@ public:
explicit FlatpakReferencesModel(QObject *parent = nullptr);
enum Roles { Name = Qt::UserRole + 1, Version, Icon, Ref };
+ Q_ENUM(Roles)
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
diff --git a/kcm.cpp b/kcm.cpp
index a98c9c5..0e2b16d 100644
--- a/kcm.cpp
+++ b/kcm.cpp
@@ -17,6 +17,7 @@ KCMFlatpak::KCMFlatpak(QObject *parent, const KPluginMetaData &data, const QVari
{
qmlRegisterUncreatableType<KCMFlatpak>("org.kde.plasma.kcm.flatpakpermissions", 1, 0, "KCMFlatpak", QString());
qmlRegisterType<FlatpakPermissionModel>("org.kde.plasma.kcm.flatpakpermissions", 1, 0, "FlatpakPermissionModel");
+ qmlRegisterUncreatableType<FlatpakReferencesModel>("org.kde.plasma.kcm.flatpakpermissions", 1, 0, "FlatpakReferencesModel", QStringLiteral("For enum access only"));
connect(m_refsModel, &FlatpakReferencesModel::needsLoad, this, &KCMFlatpak::load);
connect(m_refsModel, &FlatpakReferencesModel::needsSaveChanged, this, &KCMFlatpak::refreshSaveNeeded);
--
2.39.2

View File

@ -0,0 +1,55 @@
From d852e44cb5e4ff7b49ba91921517cd0679431c28 Mon Sep 17 00:00:00 2001
From: ivan tkachenko <me@ratijas.tk>
Date: Wed, 1 Mar 2023 01:20:15 +0300
Subject: [PATCH 2/4] Avoid duplicating connections between ref and its ref
model
These two connections should be established once in constructor, not on
every call to setter. Because every time when the setter is called, a
new connections are established which are not bound to the lifetime of
model object being set. But, the model object assigned is not managed
by this Ref object, and will be destroyed without any notice, most
importantly without calling setter with null argument which would be
the only way to clean up these extra connections.
Replaces https://invent.kde.org/plasma/flatpak-kcm/-/merge_requests/38
(cherry picked from commit b114d6e1e598c95ade68ef62c1a39ac32d38a29d)
---
flatpakreference.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/flatpakreference.cpp b/flatpakreference.cpp
index a2b5d71..d95f496 100644
--- a/flatpakreference.cpp
+++ b/flatpakreference.cpp
@@ -35,6 +35,9 @@ FlatpakReference::FlatpakReference(FlatpakReferencesModel *parent,
, m_refsModel(refsModel)
{
m_path.append(m_id);
+
+ connect(this, &FlatpakReference::needsLoad, parent, &FlatpakReferencesModel::needsLoad);
+ connect(this, &FlatpakReference::needsSaveChanged, parent, &FlatpakReferencesModel::needsSaveChanged);
}
QString FlatpakReference::name() const
@@ -78,16 +81,12 @@ void FlatpakReference::setPermsModel(FlatpakPermissionModel *permsModel)
if (permsModel != m_permsModel) {
if (m_permsModel) {
disconnect(m_permsModel, &FlatpakPermissionModel::referenceChanged, this, &FlatpakReference::needsLoad);
- disconnect(this, &FlatpakReference::needsLoad, m_refsModel, &FlatpakReferencesModel::needsLoad);
disconnect(m_permsModel, &FlatpakPermissionModel::dataChanged, this, &FlatpakReference::needsSaveChanged);
- disconnect(this, &FlatpakReference::needsSaveChanged, m_refsModel, &FlatpakReferencesModel::needsSaveChanged);
}
m_permsModel = permsModel;
if (m_permsModel) {
connect(m_permsModel, &FlatpakPermissionModel::referenceChanged, this, &FlatpakReference::needsLoad);
- connect(this, &FlatpakReference::needsLoad, m_refsModel, &FlatpakReferencesModel::needsLoad);
connect(m_permsModel, &FlatpakPermissionModel::dataChanged, this, &FlatpakReference::needsSaveChanged);
- connect(this, &FlatpakReference::needsSaveChanged, m_refsModel, &FlatpakReferencesModel::needsSaveChanged);
}
}
}
--
2.39.2

View File

@ -0,0 +1,41 @@
From b4ea85ce701b3cac3f9e997d9cb391a34ff4d4bc Mon Sep 17 00:00:00 2001
From: ivan tkachenko <me@ratijas.tk>
Date: Mon, 13 Feb 2023 23:38:13 +0300
Subject: [PATCH 3/4] Port from NULL to nullptr
(cherry picked from commit 6363d6fca26b357ac4c988fcfb0eda5069093926)
---
flatpakreference.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/flatpakreference.cpp b/flatpakreference.cpp
index d95f496..884a12f 100644
--- a/flatpakreference.cpp
+++ b/flatpakreference.cpp
@@ -131,10 +131,10 @@ bool FlatpakReference::isDefaults() const
FlatpakReferencesModel::FlatpakReferencesModel(QObject *parent)
: QAbstractListModel(parent)
{
- g_autoptr(FlatpakInstallation) installation = flatpak_installation_new_system(NULL, NULL);
- g_autoptr(GPtrArray) installedApps = flatpak_installation_list_installed_refs_by_kind(installation, FLATPAK_REF_KIND_APP, NULL, NULL);
- g_autoptr(FlatpakInstallation) userInstallation = flatpak_installation_new_user(NULL, NULL);
- g_autoptr(GPtrArray) installedUserApps = flatpak_installation_list_installed_refs_by_kind(userInstallation, FLATPAK_REF_KIND_APP, NULL, NULL);
+ g_autoptr(FlatpakInstallation) installation = flatpak_installation_new_system(nullptr, nullptr);
+ g_autoptr(GPtrArray) installedApps = flatpak_installation_list_installed_refs_by_kind(installation, FLATPAK_REF_KIND_APP, nullptr, nullptr);
+ g_autoptr(FlatpakInstallation) userInstallation = flatpak_installation_new_user(nullptr, nullptr);
+ g_autoptr(GPtrArray) installedUserApps = flatpak_installation_list_installed_refs_by_kind(userInstallation, FLATPAK_REF_KIND_APP, nullptr, nullptr);
g_ptr_array_extend_and_steal(installedApps, installedUserApps);
QString path = FlatpakHelper::permDataFilePath();
@@ -147,7 +147,7 @@ FlatpakReferencesModel::FlatpakReferencesModel(QObject *parent)
}
QString appBasePath = QString::fromUtf8(flatpak_installed_ref_get_deploy_dir(FLATPAK_INSTALLED_REF(g_ptr_array_index(installedApps, i))));
QString icon = FlatpakHelper::iconPath(name, id, appBasePath);
- g_autoptr(GBytes) data = flatpak_installed_ref_load_metadata(FLATPAK_INSTALLED_REF(g_ptr_array_index(installedApps, i)), NULL, NULL);
+ g_autoptr(GBytes) data = flatpak_installed_ref_load_metadata(FLATPAK_INSTALLED_REF(g_ptr_array_index(installedApps, i)), nullptr, nullptr);
gsize len = 0;
auto buff = g_bytes_get_data(data, &len);
const QByteArray metadata((const char *)buff, len);
--
2.39.2

View File

@ -0,0 +1,31 @@
From f0bf57cdb8436f357d0eedd3a306b9c9487f11cb Mon Sep 17 00:00:00 2001
From: ivan tkachenko <me@ratijas.tk>
Date: Wed, 1 Mar 2023 02:17:06 +0300
Subject: [PATCH 4/4] Fix GLib memory management issue
(process:81718): GLib-CRITICAL **: 03:12:47.357: g_atomic_ref_count_dec: assertion 'old_value > 0' failed
(cherry picked from commit 44edeeb14685e34ba1a3d3793d6d09fcbc8f8041)
---
flatpakreference.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/flatpakreference.cpp b/flatpakreference.cpp
index 884a12f..958efc5 100644
--- a/flatpakreference.cpp
+++ b/flatpakreference.cpp
@@ -134,8 +134,10 @@ FlatpakReferencesModel::FlatpakReferencesModel(QObject *parent)
g_autoptr(FlatpakInstallation) installation = flatpak_installation_new_system(nullptr, nullptr);
g_autoptr(GPtrArray) installedApps = flatpak_installation_list_installed_refs_by_kind(installation, FLATPAK_REF_KIND_APP, nullptr, nullptr);
g_autoptr(FlatpakInstallation) userInstallation = flatpak_installation_new_user(nullptr, nullptr);
- g_autoptr(GPtrArray) installedUserApps = flatpak_installation_list_installed_refs_by_kind(userInstallation, FLATPAK_REF_KIND_APP, nullptr, nullptr);
+ // it's the only pointer, so extend_and_steal will destroy it.
+ GPtrArray *installedUserApps = flatpak_installation_list_installed_refs_by_kind(userInstallation, FLATPAK_REF_KIND_APP, nullptr, nullptr);
g_ptr_array_extend_and_steal(installedApps, installedUserApps);
+ installedUserApps = nullptr;
QString path = FlatpakHelper::permDataFilePath();
for (uint i = 0; i < installedApps->len; ++i) {
--
2.39.2

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1c823c41b475e2a06d064c6c5353ee0b1e70415cc2ca8995af3311f78b9694ac
size 203996

View File

@ -1,16 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEE4KPrIC+OV1KOE+cv11dEg7tXsY0FAmP0q7QACgkQ11dEg7tX
sY2G/A/+NRawdNKhBWD2y6VuyPkz5fP0apZM4aC3szBmY38cbufHOGwU9C96JfxD
UM9+wbP4+sSVxCRcM0jU7tzVhk6WLDjIkx7w+xG+LGqfxpd7Ne6+NprXkC65ErIH
Z654pLVYPym0in9uxnVTQ6CUg9XWCAkxbDFAjPw/7Q1qgwQHnY3/u6v3z/E7yefW
Jr5ZQEErv5PFgtyqfWUtkV4mLvpQPCJAQ4IEBF+DW0XIfuUwEJYdju3km+0cZwka
RgMSfuQ1Azxkl+TyNtAufyHR0aWDSckhWObAZqdN+6s3JTh+n/5ku4AvWw0idc4b
Y6kHD85o/KAcep8oTqEQUH1d85JvBbOUTsMo2yqvU3CB2EHjbEOlvQJB4BUZKlDF
zmCCGGyZP7liM6doIK3/pvc3hrtys6Evr2oDuqXAK91MT1UPzfbpeRqgNDG7FjC0
YiUM5LM0yiwRqE/ybNqQ/YWGfiaBm0QWdXAhd3QkkyISvFFVss1OGuAIu1sAFMdf
HOC3k5vfxxVj82x/xhh5jlOwWT58cvKbtSfRVBL0e4lpA3NZv5uoy6Za+DDh1ZDs
flW3aOXEPHmx2XhBA2QucLBAfYhxajp4LcWN4hShO0sVaUsjQSWDDrp3nuQhnlR2
sjiiJKkNxtrbybRp3kKFxeMlkCUCaOFkkhR+7ZGmR5uPYLuEujY=
=EiID
-----END PGP SIGNATURE-----

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ae236b2143a8245731abf48878df96d557f5481b8a7313363ab23fbed1363c67
size 204676

View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEE4KPrIC+OV1KOE+cv11dEg7tXsY0FAmP98LIACgkQ11dEg7tX
sY0UAQ/8DcaQpMOyue6Y9yWobW6HKBPU3NrLfKFy7C1x35Wkms0wQU0vX8cKWFjo
djWonO+dg8V/mOWtjC1lx9C35pnNU4upBaVBx4+QBwXHa+wzDLfJj556WtAC+0Rp
3cgZHqjBwQr2jwTU2sNhp8GoRDmvNmZ3OT6lP6IaJ85aLxBe96ZQaDYSFowU/HkY
6Z/awn5YnrqFL1TyjQ7aw8iuvNIjmnfX3fWA1hO852A5Red+jBxD6KrjZvkqmRIV
7x4P5RV/Zq2VCMwChgLPiB9PldrND72l/wCJILeLXrEy3w3k3dBhUrmwZ+ETsM3g
gDhlYb3LgvkA0q0ORJhVePCNmMBXo6SUh88v5QlpmSKTbAKdWR2Pf4GdQOEeHP7Z
/UAGcnAFEfxyNZztWeawLBRbR8f6D0LOIOWyd3x/tuxmmJfnsEZ06/L2OpB6WF14
dEvxFyKTA5+HORVwj8P7vU8o1/uQbhnpR11OObphsW7QxATXPdWUIp8CDYSKzK3O
L7OcClf8e/33tMfNyRUGLjfz9mK1tYMjJ3YLCrflZkjfc4cBEGaKzQfMmiBgNRd/
yvfQnFyscVBepgAJe+jdVIzjlybmZTzQdTR7Xjih30Eb4UI752Yn2C2HexzuedQK
a0fI/GFYQ+1vr0gDFZJcDeWI51Z/g4jJAt4vEe2YVhPSmd7ZsUM=
=yy9E
-----END PGP SIGNATURE-----

View File

@ -1,3 +1,30 @@
-------------------------------------------------------------------
Wed Mar 1 07:47:56 UTC 2023 - Fabian Vogt <fabian@ritter-vogt.de>
- Apply important fixes from the 5.27 branch:
* 0001-Expose-FlatpakReferencesModel-to-QML.patch
* 0002-Avoid-duplicating-connections-between-ref-and-its-re.patch
* 0003-Port-from-NULL-to-nullptr.patch
* 0004-Fix-GLib-memory-management-issue.patch
-------------------------------------------------------------------
Tue Feb 28 17:34:14 UTC 2023 - Fabian Vogt <fabian@ritter-vogt.de>
- Update to 5.27.2
* New bugfix release
* For more details please see:
* https://kde.org/announcements/plasma/5/5.27.2
- Changes since 5.27.1:
* Adjust popup modals for the footer padding in KCM
* UI: Adapt "Apply / Discard" dialog to narrow screens: turn row layout into column
* Plasma/5.27: Revert partially last commit due to string freeze
* UI: Add changed app's name & icon to the "Apply / Discard" dialog
* UI: Reparent app switching dialog, so that it is centered to the whole view
* Use standard QQC2 namespace for Dialog constants
* UI: Dynamically create "Apply / Discard" dialog when switching apps
* Move app changing logic out of delegate, fetch ref directly from model
* UI: Don't try to reload app when clicking on the current one
-------------------------------------------------------------------
Tue Feb 21 14:09:16 UTC 2023 - Fabian Vogt <fabian@ritter-vogt.de>

View File

@ -20,7 +20,7 @@
%bcond_without released
Name: kcm_flatpak
Version: 5.27.1
Version: 5.27.2
Release: 0
Summary: Flatpak Permissions Management KCM
License: GPL-2.0-or-later
@ -31,6 +31,11 @@ Source: https://download.kde.org/stable/plasma/%{version}/flatpak-kcm-%{
Source1: https://download.kde.org/stable/plasma/%{version}/flatpak-kcm-%{version}.tar.xz.sig
Source2: plasma.keyring
%endif
# PATCH-FIX-UPSTREAM
Patch1: 0001-Expose-FlatpakReferencesModel-to-QML.patch
Patch2: 0002-Avoid-duplicating-connections-between-ref-and-its-re.patch
Patch3: 0003-Port-from-NULL-to-nullptr.patch
Patch4: 0004-Fix-GLib-memory-management-issue.patch
BuildRequires: extra-cmake-modules >= 5.98.0
BuildRequires: kf5-filesystem
BuildRequires: pkgconfig