summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKalev Lember <klember@redhat.com>2018-12-27 13:31:08 +0100
committerKalev Lember <klember@redhat.com>2018-12-27 14:02:56 +0100
commitd2b9e072ed2303c698b43d567534d88ed07669c0 (patch)
tree8386ecf088808b2ad7c5980e73bed754a3d44694
parentf9093cda1ba20505e600b68c09915126587638cc (diff)
downloadappstream-glib-wip/kalev/as-store-search-cache-ref.tar.gz
store: Fix threading related crashes when creating the search cachewip/kalev/as-store-search-cache-ref
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.c4
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);