Backport an upstream patch to fix common gnome-software crash

This commit is contained in:
Kalev Lember 2018-12-28 11:45:27 +01:00
parent 9aa0a67f7c
commit f8f0bd3917
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,45 @@
From 584faccb9e1de36265af78064e1b7ef32d4d59a3 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Thu, 27 Dec 2018 13:31:08 +0100
Subject: [PATCH] store: Fix threading related crashes when creating the search
cache
Keep a ref on the AsApp in the worker thread to make sure it doesn't get
destroyed in another thread while being processed.
https://bugzilla.redhat.com/show_bug.cgi?id=1662130
https://bugzilla.redhat.com/show_bug.cgi?id=1661701
https://bugzilla.redhat.com/show_bug.cgi?id=1661382
https://bugzilla.redhat.com/show_bug.cgi?id=1658140
https://bugzilla.redhat.com/show_bug.cgi?id=1644026
https://bugzilla.redhat.com/show_bug.cgi?id=1639558
https://bugzilla.redhat.com/show_bug.cgi?id=1570096
---
libappstream-glib/as-store.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c
index 2fdbe8e..3a03fcd 100644
--- a/libappstream-glib/as-store.c
+++ b/libappstream-glib/as-store.c
@@ -3407,7 +3407,7 @@ as_store_search_per_user (AsStore *store,
static void
as_store_load_search_cache_cb (gpointer data, gpointer user_data)
{
- AsApp *app = AS_APP (data);
+ g_autoptr(AsApp) app = AS_APP (data);
as_app_search_matches (app, NULL);
}
@@ -3446,7 +3446,7 @@ as_store_load_search_cache (AsStore *store)
g_mutex_lock (&priv->mutex);
for (i = 0; i < priv->array->len; i++) {
AsApp *app = g_ptr_array_index (priv->array, i);
- g_thread_pool_push (pool, app, NULL);
+ g_thread_pool_push (pool, g_object_ref (app), NULL);
}
g_mutex_unlock (&priv->mutex);
g_thread_pool_free (pool, FALSE, TRUE);
--
2.19.1

View File

@ -6,13 +6,14 @@
Summary: Library for AppStream metadata
Name: libappstream-glib
Version: 0.7.14
Release: 3%{?dist}
Release: 4%{?dist}
License: LGPLv2+
URL: http://people.freedesktop.org/~hughsient/appstream-glib/
Source0: http://people.freedesktop.org/~hughsient/appstream-glib/releases/appstream-glib-%{version}.tar.xz
# Backported from upstream
Patch0: as_utils_vercmp_full.patch
Patch1: as-store-locking.patch
Patch2: 0001-store-Fix-threading-related-crashes-when-creating-th.patch
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: docbook-utils
@ -147,6 +148,9 @@ GLib headers and libraries for appstream-builder.
%{_datadir}/gir-1.0/AppStreamBuilder-1.0.gir
%changelog
* Fri Dec 28 2018 Kalev Lember <klember@redhat.com> 0.7.14-4
- Backport an upstream patch to fix common gnome-software crash
* Tue Dec 18 2018 Kalev Lember <klember@redhat.com> 0.7.14-3
- Backport AsStore locking patches from upstream