Backport a couple of bug fixes from upstream (icon display, crash bug)
This commit is contained in:
parent
c68eece936
commit
dbac9fa7a3
32
0001-gs-app-Add-additional-icon-debug-information.patch
Normal file
32
0001-gs-app-Add-additional-icon-debug-information.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From 81a2e01d407fc903a83b4c1a82749d2591397240 Mon Sep 17 00:00:00 2001
|
||||
From: Philip Withnall <pwithnall@endlessos.org>
|
||||
Date: Tue, 16 Mar 2021 13:33:40 +0000
|
||||
Subject: [PATCH 1/4] gs-app: Add additional icon debug information
|
||||
|
||||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
||||
---
|
||||
lib/gs-app.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/gs-app.c b/lib/gs-app.c
|
||||
index 771743330..cb2549d4c 100644
|
||||
--- a/lib/gs-app.c
|
||||
+++ b/lib/gs-app.c
|
||||
@@ -1828,11 +1828,12 @@ gs_app_get_icon_for_size (GsApp *app,
|
||||
* lazily created. */
|
||||
for (guint i = 0; priv->icons != NULL && i < priv->icons->len; i++) {
|
||||
GIcon *icon = priv->icons->pdata[i];
|
||||
+ g_autofree gchar *icon_str = g_icon_to_string (icon);
|
||||
guint icon_width = gs_icon_get_width (icon);
|
||||
guint icon_scale = gs_icon_get_scale (icon);
|
||||
|
||||
- g_debug ("\tConsidering icon of type %s, width %u×%u",
|
||||
- G_OBJECT_TYPE_NAME (icon), icon_width, icon_scale);
|
||||
+ g_debug ("\tConsidering icon of type %s (%s), width %u×%u",
|
||||
+ G_OBJECT_TYPE_NAME (icon), icon_str, icon_width, icon_scale);
|
||||
|
||||
/* Ignore icons with unknown width and skip over ones which
|
||||
* are too small. */
|
||||
--
|
||||
2.30.2
|
||||
|
@ -0,0 +1,48 @@
|
||||
From 9a63168893a678f97fe6e3bfde2d6e5debf151c3 Mon Sep 17 00:00:00 2001
|
||||
From: Philip Withnall <pwithnall@endlessos.org>
|
||||
Date: Tue, 16 Mar 2021 13:34:13 +0000
|
||||
Subject: [PATCH 2/4] =?UTF-8?q?gs-appstream:=20Fix=20handling=20of=20icons?=
|
||||
=?UTF-8?q?=20where=20appdata=20doesn=E2=80=99t=20specify=20width?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
If the `<icon>` element in the appdata doesn’t specify a `width`
|
||||
attribute, `xb_node_get_attr_as_uint()` will return `G_MAXUINT64`.
|
||||
However, its return value was being assigned to `sz`, which is a
|
||||
`guint`, and hence it was being truncated. This resulted in icons having
|
||||
their widths set to `G_MAXUINT`, and hence being prioritised for display
|
||||
when that was not necessarily correct.
|
||||
|
||||
Fix that by explicitly handling the failure response from
|
||||
`xb_node_get_attr_as_uint()`.
|
||||
|
||||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
||||
|
||||
Fixes: #1171
|
||||
---
|
||||
plugins/core/gs-appstream.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c
|
||||
index a9cf97270..22fed1154 100644
|
||||
--- a/plugins/core/gs-appstream.c
|
||||
+++ b/plugins/core/gs-appstream.c
|
||||
@@ -149,8 +149,12 @@ gs_appstream_new_icon (XbNode *component, XbNode *n, AsIconKind icon_kind, guint
|
||||
default:
|
||||
as_icon_set_name (icon, xb_node_get_text (n));
|
||||
}
|
||||
- if (sz == 0)
|
||||
- sz = xb_node_get_attr_as_uint (n, "width");
|
||||
+ if (sz == 0) {
|
||||
+ guint64 width = xb_node_get_attr_as_uint (n, "width");
|
||||
+ if (width > 0 && width < G_MAXUINT)
|
||||
+ sz = width;
|
||||
+ }
|
||||
+
|
||||
if (sz > 0) {
|
||||
as_icon_set_width (icon, sz);
|
||||
as_icon_set_height (icon, sz);
|
||||
--
|
||||
2.30.2
|
||||
|
@ -0,0 +1,61 @@
|
||||
From 3e86354cc5ccffc5ef27fa9e5ce2e99e3e60bc8c Mon Sep 17 00:00:00 2001
|
||||
From: Philip Withnall <pwithnall@endlessos.org>
|
||||
Date: Tue, 16 Mar 2021 13:36:23 +0000
|
||||
Subject: [PATCH 3/4] gs-icon: Work around invalid icon names from some
|
||||
appstream files
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Cached icons are supposed to provide a name (like `krita.png`), `width`
|
||||
and `height` attributes, and then gnome-software can build the path to
|
||||
the cached icon file according to
|
||||
https://www.freedesktop.org/software/appstream/docs/sect-AppStream-IconCache.html#spec-iconcache-location.
|
||||
|
||||
Due to a bug in appstream-builder in appstream-glib
|
||||
(https://github.com/hughsie/appstream-glib/pull/390), some appstream
|
||||
files – for example, rpmfusion-free-33 – had invalid cached icon names,
|
||||
which resulted in those icons not being loadable, and not appearing for
|
||||
their applications.
|
||||
|
||||
As it may take a while for the fix in appstream-builder to be merged and
|
||||
be used to regenerate all the appstream files for different app
|
||||
repositories, add a workaround in gnome-software.
|
||||
|
||||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
||||
|
||||
Helps: #1171
|
||||
---
|
||||
lib/gs-icon.c | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/lib/gs-icon.c b/lib/gs-icon.c
|
||||
index a88e62d34..955ab0217 100644
|
||||
--- a/lib/gs-icon.c
|
||||
+++ b/lib/gs-icon.c
|
||||
@@ -200,12 +200,22 @@ gs_icon_load_cached (AsIcon *icon)
|
||||
{
|
||||
const gchar *filename = as_icon_get_filename (icon);
|
||||
const gchar *name = as_icon_get_name (icon);
|
||||
+ g_autofree gchar *name_allocated = NULL;
|
||||
g_autofree gchar *full_filename = NULL;
|
||||
g_autoptr(GFile) file = NULL;
|
||||
|
||||
if (filename == NULL || name == NULL)
|
||||
return NULL;
|
||||
|
||||
+ /* FIXME: Work around https://github.com/hughsie/appstream-glib/pull/390
|
||||
+ * where appstream files generated with appstream-builder from
|
||||
+ * appstream-glib, with its hidpi option enabled, will contain an
|
||||
+ * unnecessary size subdirectory in the icon name. */
|
||||
+ if (g_str_has_prefix (name, "64x64/"))
|
||||
+ name = name_allocated = g_strdup (name + strlen ("64x64/"));
|
||||
+ else if (g_str_has_prefix (name, "128x128/"))
|
||||
+ name = name_allocated = g_strdup (name + strlen ("128x128/"));
|
||||
+
|
||||
if (!g_str_has_suffix (filename, name)) {
|
||||
/* Spec: https://www.freedesktop.org/software/appstream/docs/sect-AppStream-IconCache.html#spec-iconcache-location */
|
||||
if (as_icon_get_scale (icon) <= 1) {
|
||||
--
|
||||
2.30.2
|
||||
|
@ -0,0 +1,29 @@
|
||||
From 80834ed7d336f103cfc7199fa96c6f2a860be438 Mon Sep 17 00:00:00 2001
|
||||
From: Philip Withnall <pwithnall@endlessos.org>
|
||||
Date: Thu, 18 Mar 2021 13:11:36 +0000
|
||||
Subject: [PATCH 4/4] gs-shell-search-provider: Fix crash in variant handling
|
||||
for icons
|
||||
|
||||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
||||
|
||||
Fixes: #1179
|
||||
---
|
||||
src/gs-shell-search-provider.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/gs-shell-search-provider.c b/src/gs-shell-search-provider.c
|
||||
index 8bafc9a8c..27bbb45f7 100644
|
||||
--- a/src/gs-shell-search-provider.c
|
||||
+++ b/src/gs-shell-search-provider.c
|
||||
@@ -254,7 +254,7 @@ handle_get_result_metas (GsShellSearchProvider2 *skeleton,
|
||||
if (icon != NULL) {
|
||||
g_autofree gchar *icon_str = g_icon_to_string (icon);
|
||||
if (icon_str != NULL) {
|
||||
- g_variant_builder_add (&meta, "{sv}", "gicon", icon_str);
|
||||
+ g_variant_builder_add (&meta, "{sv}", "gicon", g_variant_new_string (icon_str));
|
||||
} else {
|
||||
g_autoptr(GVariant) icon_serialized = g_icon_serialize (icon);
|
||||
g_variant_builder_add (&meta, "{sv}", "icon", icon_serialized);
|
||||
--
|
||||
2.30.2
|
||||
|
@ -12,13 +12,24 @@
|
||||
|
||||
Name: gnome-software
|
||||
Version: 40~rc
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: A software center for GNOME
|
||||
|
||||
License: GPLv2+
|
||||
URL: https://wiki.gnome.org/Apps/Software
|
||||
Source0: https://download.gnome.org/sources/gnome-software/40/%{name}-%{tarball_version}.tar.xz
|
||||
|
||||
# Fix display of icons for packages and snaps
|
||||
# https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1171
|
||||
# https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/653
|
||||
Patch0001: 0001-gs-app-Add-additional-icon-debug-information.patch
|
||||
Patch0002: 0002-gs-appstream-Fix-handling-of-icons-where-appdata-doe.patch
|
||||
Patch0003: 0003-gs-icon-Work-around-invalid-icon-names-from-some-app.patch
|
||||
# Fix crash that sometimes breaks search provider or stops window appearing
|
||||
# https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1179
|
||||
# https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/658
|
||||
Patch0004: 0004-gs-shell-search-provider-Fix-crash-in-variant-handli.patch
|
||||
|
||||
BuildRequires: appstream-devel >= %{appstream_version}
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gettext
|
||||
@ -200,6 +211,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
|
||||
%{_datadir}/gtk-doc/html/gnome-software
|
||||
|
||||
%changelog
|
||||
* Thu Mar 18 2021 Adam Williamson <awilliam@redhat.com> - 40~rc-2
|
||||
- Backport a couple of bug fixes from upstream (icon display, crash bug)
|
||||
|
||||
* Mon Mar 15 2021 Kalev Lember <klember@redhat.com> - 40~rc-1
|
||||
- Update to 40.rc
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user