Related: #1967855 (Update to 40.2)
This commit is contained in:
parent
1d0dddc627
commit
7da432acec
48
0001-crash-with-broken-theme.patch
Normal file
48
0001-crash-with-broken-theme.patch
Normal file
@ -0,0 +1,48 @@
|
||||
From 3a644c151f27f439c36170f0958fd21cf1cc54d0 Mon Sep 17 00:00:00 2001
|
||||
From: Milan Crha <mcrha@redhat.com>
|
||||
Date: Thu, 3 Jun 2021 08:33:53 +0200
|
||||
Subject: [PATCH] gs-feature-tile: Do not abort when the theme is broken
|
||||
|
||||
Just print a warning when the theme doesn't provide 'theme_fg_color' and
|
||||
fallback to black color.
|
||||
|
||||
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1228
|
||||
---
|
||||
src/gs-feature-tile.c | 14 +++++++++++---
|
||||
1 file changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/gs-feature-tile.c b/src/gs-feature-tile.c
|
||||
index 1c85083eb..158af1e56 100644
|
||||
--- a/src/gs-feature-tile.c
|
||||
+++ b/src/gs-feature-tile.c
|
||||
@@ -268,7 +268,6 @@ gs_feature_tile_refresh (GsAppTile *self)
|
||||
if (key_colors != tile->key_colors_cache) {
|
||||
g_autoptr(GArray) colors = NULL;
|
||||
GdkRGBA fg_rgba;
|
||||
- gboolean fg_rgba_valid;
|
||||
GsHSBC fg_hsbc;
|
||||
|
||||
/* Look up the foreground colour for the feature tile,
|
||||
@@ -283,8 +282,17 @@ gs_feature_tile_refresh (GsAppTile *self)
|
||||
* @min_abs_contrast contrast with the foreground, so
|
||||
* that the text is legible.
|
||||
*/
|
||||
- fg_rgba_valid = gtk_style_context_lookup_color (context, "theme_fg_color", &fg_rgba);
|
||||
- g_assert (fg_rgba_valid);
|
||||
+ if (!gtk_style_context_lookup_color (context, "theme_fg_color", &fg_rgba)) {
|
||||
+ static gboolean i_know = FALSE;
|
||||
+ if (!i_know) {
|
||||
+ i_know = TRUE;
|
||||
+ g_warning ("The theme doesn't provide 'theme_fg_color', fallbacking to black");
|
||||
+ }
|
||||
+ fg_rgba.red = 0.0;
|
||||
+ fg_rgba.green = 0.0;
|
||||
+ fg_rgba.blue = 0.0;
|
||||
+ fg_rgba.alpha = 1.0;
|
||||
+ }
|
||||
|
||||
gtk_rgb_to_hsv (fg_rgba.red, fg_rgba.green, fg_rgba.blue,
|
||||
&fg_hsbc.hue, &fg_hsbc.saturation, &fg_hsbc.brightness);
|
||||
--
|
||||
GitLab
|
||||
|
@ -1,312 +0,0 @@
|
||||
From 64a0eaa4a1b1402a0e5926d0c274cfa962589149 Mon Sep 17 00:00:00 2001
|
||||
From: Philip Withnall <pwithnall@endlessos.org>
|
||||
Date: Thu, 29 Apr 2021 15:49:01 +0100
|
||||
Subject: [PATCH 1/6] gs-app: Drop requirement for set_version_history() to be
|
||||
non-NULL
|
||||
|
||||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
||||
---
|
||||
lib/gs-app.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/lib/gs-app.c b/lib/gs-app.c
|
||||
index e8eb9d48b..2db3e6251 100644
|
||||
--- a/lib/gs-app.c
|
||||
+++ b/lib/gs-app.c
|
||||
@@ -5365,7 +5365,6 @@ gs_app_set_version_history (GsApp *app, GPtrArray *version_history)
|
||||
GsAppPrivate *priv = gs_app_get_instance_private (app);
|
||||
g_autoptr(GMutexLocker) locker = NULL;
|
||||
g_return_if_fail (GS_IS_APP (app));
|
||||
- g_return_if_fail (version_history != NULL);
|
||||
locker = g_mutex_locker_new (&priv->mutex);
|
||||
_g_set_ptr_array (&priv->version_history, version_history);
|
||||
}
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From 3229d3d66347c5cd317d12db9b456f8eaefad678 Mon Sep 17 00:00:00 2001
|
||||
From: Philip Withnall <pwithnall@endlessos.org>
|
||||
Date: Thu, 29 Apr 2021 15:45:33 +0100
|
||||
Subject: [PATCH 2/6] gs-app: Clarify documentation/annotations for version
|
||||
history
|
||||
|
||||
This clarifies the documentation for the existing behaviour.
|
||||
|
||||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
||||
|
||||
Helps: #1227
|
||||
---
|
||||
lib/gs-app.c | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/lib/gs-app.c b/lib/gs-app.c
|
||||
index 2db3e6251..5ef7e9942 100644
|
||||
--- a/lib/gs-app.c
|
||||
+++ b/lib/gs-app.c
|
||||
@@ -129,7 +129,7 @@ typedef struct
|
||||
GsPluginAction pending_action;
|
||||
GsAppPermissions permissions;
|
||||
gboolean is_update_downloaded;
|
||||
- GPtrArray *version_history; /* (element-type AsRelease) */
|
||||
+ GPtrArray *version_history; /* (element-type AsRelease) (nullable) (owned) */
|
||||
} GsAppPrivate;
|
||||
|
||||
enum {
|
||||
@@ -5337,7 +5337,8 @@ gs_app_set_update_permissions (GsApp *app, GsAppPermissions update_permissions)
|
||||
* Gets the list of past releases for an application (including the latest
|
||||
* one).
|
||||
*
|
||||
- * Returns: (element-type AsRelease) (transfer none): a list
|
||||
+ * Returns: (element-type AsRelease) (transfer none) (nullable): a list, or
|
||||
+ * %NULL if the version history is not known
|
||||
*
|
||||
* Since: 40
|
||||
**/
|
||||
@@ -5352,8 +5353,8 @@ gs_app_get_version_history (GsApp *app)
|
||||
/**
|
||||
* gs_app_set_version_history:
|
||||
* @app: a #GsApp
|
||||
- * @version_history: (element-type AsRelease): a set of entries representing
|
||||
- * the version history
|
||||
+ * @version_history: (element-type AsRelease) (nullable): a set of entries
|
||||
+ * representing the version history, or %NULL if none are known
|
||||
*
|
||||
* Set the list of past releases for an application (including the latest one).
|
||||
*
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From 7910276e5116db3f51dc5b088f3eb567e2472f17 Mon Sep 17 00:00:00 2001
|
||||
From: Philip Withnall <pwithnall@endlessos.org>
|
||||
Date: Thu, 29 Apr 2021 15:46:39 +0100
|
||||
Subject: [PATCH 3/6] gs-app: Squash empty arrays to NULL in
|
||||
gs_app_set_version_history()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This should save a little bit of memory. I have not updated the
|
||||
documentation to guarantee this behaviour because it’s a little unusual;
|
||||
simpler to allow callers to continue handling `NULL` and empty array
|
||||
cases explicitly.
|
||||
|
||||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
||||
|
||||
Helps: #1227
|
||||
---
|
||||
lib/gs-app.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/lib/gs-app.c b/lib/gs-app.c
|
||||
index 5ef7e9942..6c6bb6fe6 100644
|
||||
--- a/lib/gs-app.c
|
||||
+++ b/lib/gs-app.c
|
||||
@@ -5366,6 +5366,10 @@ gs_app_set_version_history (GsApp *app, GPtrArray *version_history)
|
||||
GsAppPrivate *priv = gs_app_get_instance_private (app);
|
||||
g_autoptr(GMutexLocker) locker = NULL;
|
||||
g_return_if_fail (GS_IS_APP (app));
|
||||
+
|
||||
+ if (version_history != NULL && version_history->len == 0)
|
||||
+ version_history = NULL;
|
||||
+
|
||||
locker = g_mutex_locker_new (&priv->mutex);
|
||||
_g_set_ptr_array (&priv->version_history, version_history);
|
||||
}
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From ff5d189202788ec84bf690b8ddb184240ae68e2d Mon Sep 17 00:00:00 2001
|
||||
From: Philip Withnall <pwithnall@endlessos.org>
|
||||
Date: Thu, 29 Apr 2021 15:47:40 +0100
|
||||
Subject: [PATCH 4/6] gs-app: Fix generic setters to handle NULL arrays
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The previous implementation of the functions didn’t handle `NULL`
|
||||
arrays.
|
||||
|
||||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
||||
|
||||
Helps: #1227
|
||||
---
|
||||
lib/gs-app.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/gs-app.c b/lib/gs-app.c
|
||||
index 6c6bb6fe6..efbc4756a 100644
|
||||
--- a/lib/gs-app.c
|
||||
+++ b/lib/gs-app.c
|
||||
@@ -184,9 +184,11 @@ _g_set_ptr_array (GPtrArray **array_ptr, GPtrArray *new_array)
|
||||
{
|
||||
if (*array_ptr == new_array)
|
||||
return FALSE;
|
||||
+ if (new_array != NULL)
|
||||
+ g_ptr_array_ref (new_array);
|
||||
if (*array_ptr != NULL)
|
||||
g_ptr_array_unref (*array_ptr);
|
||||
- *array_ptr = g_ptr_array_ref (new_array);
|
||||
+ *array_ptr = new_array;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -195,9 +197,11 @@ _g_set_array (GArray **array_ptr, GArray *new_array)
|
||||
{
|
||||
if (*array_ptr == new_array)
|
||||
return FALSE;
|
||||
+ if (new_array != NULL)
|
||||
+ g_array_ref (new_array);
|
||||
if (*array_ptr != NULL)
|
||||
g_array_unref (*array_ptr);
|
||||
- *array_ptr = g_array_ref (new_array);
|
||||
+ *array_ptr = new_array;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From a9597a3a9c04e5dd4571c24dba54abd95eb9fa92 Mon Sep 17 00:00:00 2001
|
||||
From: Philip Withnall <pwithnall@endlessos.org>
|
||||
Date: Thu, 29 Apr 2021 15:50:36 +0100
|
||||
Subject: [PATCH 5/6] gs-details-page: Explicitly handle empty version history
|
||||
array
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This makes the code a bit more robust.
|
||||
|
||||
It’s not actually needed, as the current behaviour of
|
||||
gs_app_get_version_history() is to either return `NULL` or a non-empty
|
||||
array — never an empty array. However, guaranteeing that behaviour would
|
||||
defy precedent in other APIs, and be confusing to document, so just
|
||||
handle the case of empty arrays in the callers anyway, to make their
|
||||
expected behaviour clear.
|
||||
|
||||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
||||
---
|
||||
src/gs-app-version-history-dialog.c | 2 +-
|
||||
src/gs-details-page.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/gs-app-version-history-dialog.c b/src/gs-app-version-history-dialog.c
|
||||
index 94d55cc0c..5262596a2 100644
|
||||
--- a/src/gs-app-version-history-dialog.c
|
||||
+++ b/src/gs-app-version-history-dialog.c
|
||||
@@ -34,7 +34,7 @@ populate_version_history (GsAppVersionHistoryDialog *dialog,
|
||||
gs_container_remove_all (GTK_CONTAINER (dialog->listbox));
|
||||
|
||||
version_history = gs_app_get_version_history (app);
|
||||
- if (version_history == NULL) {
|
||||
+ if (version_history == NULL || version_history->len == 0) {
|
||||
GtkWidget *row;
|
||||
row = gs_app_version_history_row_new ();
|
||||
gs_app_version_history_row_set_info (GS_APP_VERSION_HISTORY_ROW (row),
|
||||
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
|
||||
index cf9b4b393..22b38e929 100644
|
||||
--- a/src/gs-details-page.c
|
||||
+++ b/src/gs-details-page.c
|
||||
@@ -1305,7 +1305,7 @@ gs_details_page_refresh_all (GsDetailsPage *self)
|
||||
|
||||
/* set version history */
|
||||
version_history = gs_app_get_version_history (self->app);
|
||||
- if (version_history == NULL) {
|
||||
+ if (version_history == NULL || version_history->len == 0) {
|
||||
const char *version = gs_app_get_version (self->app);
|
||||
if (version == NULL || *version == '\0')
|
||||
gtk_widget_set_visible (self->box_version_history_frame, FALSE);
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From bb1cc3a52fca7e98b053f4c9751df28bfd505dec Mon Sep 17 00:00:00 2001
|
||||
From: Philip Withnall <pwithnall@endlessos.org>
|
||||
Date: Thu, 29 Apr 2021 15:52:43 +0100
|
||||
Subject: [PATCH 6/6] gs-app: Change gs_app_get_version_history() to return a
|
||||
ref
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
It seems the version history can be updated from a separate thread while
|
||||
refreshing. This can cause crashes if the UI thread queries the version
|
||||
history, then it’s updated from another thread, then the UI thread
|
||||
starts iterating over the `GPtrArray` it queried — which has since been
|
||||
freed.
|
||||
|
||||
Fix that by returning a strong ref to the `GPtrArray`, and doing so
|
||||
under the app’s mutex.
|
||||
|
||||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
||||
|
||||
Fixes: #1227
|
||||
---
|
||||
lib/gs-app.c | 11 ++++++++---
|
||||
src/gs-app-version-history-dialog.c | 2 +-
|
||||
src/gs-details-page.c | 2 +-
|
||||
3 files changed, 10 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/lib/gs-app.c b/lib/gs-app.c
|
||||
index efbc4756a..f165df562 100644
|
||||
--- a/lib/gs-app.c
|
||||
+++ b/lib/gs-app.c
|
||||
@@ -5341,17 +5341,22 @@ gs_app_set_update_permissions (GsApp *app, GsAppPermissions update_permissions)
|
||||
* Gets the list of past releases for an application (including the latest
|
||||
* one).
|
||||
*
|
||||
- * Returns: (element-type AsRelease) (transfer none) (nullable): a list, or
|
||||
+ * Returns: (element-type AsRelease) (transfer container) (nullable): a list, or
|
||||
* %NULL if the version history is not known
|
||||
*
|
||||
- * Since: 40
|
||||
+ * Since: 41
|
||||
**/
|
||||
GPtrArray *
|
||||
gs_app_get_version_history (GsApp *app)
|
||||
{
|
||||
GsAppPrivate *priv = gs_app_get_instance_private (app);
|
||||
+ g_autoptr(GMutexLocker) locker = NULL;
|
||||
g_return_val_if_fail (GS_IS_APP (app), NULL);
|
||||
- return priv->version_history;
|
||||
+
|
||||
+ locker = g_mutex_locker_new (&priv->mutex);
|
||||
+ if (priv->version_history == NULL)
|
||||
+ return NULL;
|
||||
+ return g_ptr_array_ref (priv->version_history);
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/src/gs-app-version-history-dialog.c b/src/gs-app-version-history-dialog.c
|
||||
index 5262596a2..8b61b7c2b 100644
|
||||
--- a/src/gs-app-version-history-dialog.c
|
||||
+++ b/src/gs-app-version-history-dialog.c
|
||||
@@ -28,7 +28,7 @@ static void
|
||||
populate_version_history (GsAppVersionHistoryDialog *dialog,
|
||||
GsApp *app)
|
||||
{
|
||||
- GPtrArray *version_history;
|
||||
+ g_autoptr(GPtrArray) version_history = NULL;
|
||||
|
||||
/* remove previous */
|
||||
gs_container_remove_all (GTK_CONTAINER (dialog->listbox));
|
||||
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
|
||||
index 22b38e929..c985f3b06 100644
|
||||
--- a/src/gs-details-page.c
|
||||
+++ b/src/gs-details-page.c
|
||||
@@ -1191,7 +1191,7 @@ gs_details_page_refresh_all (GsDetailsPage *self)
|
||||
guint64 user_integration_bf;
|
||||
gboolean show_support_box = FALSE;
|
||||
g_autofree gchar *origin = NULL;
|
||||
- GPtrArray *version_history;
|
||||
+ g_autoptr(GPtrArray) version_history = NULL;
|
||||
guint icon_size;
|
||||
|
||||
if (!gs_page_is_active (GS_PAGE (self)))
|
||||
--
|
||||
GitLab
|
||||
|
@ -11,15 +11,15 @@
|
||||
%global tarball_version %%(echo %{version} | tr '~' '.')
|
||||
|
||||
Name: gnome-software
|
||||
Version: 40.1
|
||||
Release: 2%{?dist}
|
||||
Version: 40.2
|
||||
Release: 1%{?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
|
||||
|
||||
Patch01: 001-i1227-crash-under-gs_details_page_refresh_all.patch
|
||||
Patch01: 0001-crash-with-broken-theme.patch
|
||||
|
||||
BuildRequires: appstream-devel >= %{appstream_version}
|
||||
BuildRequires: gcc
|
||||
@ -202,6 +202,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
|
||||
%{_datadir}/gtk-doc/html/gnome-software
|
||||
|
||||
%changelog
|
||||
* Fri Jun 04 2021 Milan Crha <mcrha@redhat.com> - 40.2-1
|
||||
- Related: #1967855 (Update to 40.2)
|
||||
|
||||
* Mon May 03 2021 Milan Crha <mcrha@redhat.com> - 40.1-2
|
||||
- Related: #1952776 (Add patch for crash under gs_details_page_refresh_all() (i#1227))
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (gnome-software-40.1.tar.xz) = ae805d01896d761dd82a21dedbfafba7e8ffd2d98e99da4548d846aafdf07f9a26dfa2e083ac2dda576f8b1db05bb3f26642d3a6558da86921450049870767fe
|
||||
SHA512 (gnome-software-40.2.tar.xz) = ded29be4c59130a4016d43d3e18a67c8cf3fec4761a7a57c067bf075a6f1da5b7726000172e2303ba129b3b5cb8bd22ebfad8fbf0e3248285a4864350f3a1679
|
||||
|
Loading…
Reference in New Issue
Block a user