diff options
author | Kalev Lember <klember@redhat.com> | 2018-12-27 13:31:08 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2018-12-27 20:00:37 +0000 |
commit | 584faccb9e1de36265af78064e1b7ef32d4d59a3 (patch) | |
tree | 8386ecf088808b2ad7c5980e73bed754a3d44694 | |
parent | f9093cda1ba20505e600b68c09915126587638cc (diff) | |
download | appstream-glib-584faccb9e1de36265af78064e1b7ef32d4d59a3.tar.gz |
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
-rw-r--r-- | libappstream-glib/as-store.c | 4 |
1 files 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); |