[gnome-software/gnome-41: 2/3] gs-plugin-loader: Ensure correct list is used on the job when refining wildcards
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-41: 2/3] gs-plugin-loader: Ensure correct list is used on the job when refining wildcards
- Date: Tue, 5 Oct 2021 15:05:27 +0000 (UTC)
commit 0466dff88f32428c582429ebe262871d1ef33409
Author: Milan Crha <mcrha redhat com>
Date: Tue Oct 5 16:18:22 2021 +0200
gs-plugin-loader: Ensure correct list is used on the job when refining wildcards
The plugin job is reused when refining the apps, including the wildcards,
but the gs_plugin_loader_run_refine_internal() can be called multiple times,
with different lists. Adding refined wildcards to the original list causes
invalid data being provided to the called.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1485
lib/gs-plugin-loader.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 4d5240c32..7f5859a05 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -937,14 +937,24 @@ gs_plugin_loader_run_refine_internal (GsPluginLoaderHelper *helper,
GCancellable *cancellable,
GError **error)
{
+ g_autoptr(GsAppList) previous_list = NULL;
+
+ if (list != gs_plugin_job_get_list (helper->plugin_job)) {
+ previous_list = g_object_ref (gs_plugin_job_get_list (helper->plugin_job));
+ gs_plugin_job_set_list (helper->plugin_job, list);
+ }
+
/* try to adopt each application with a plugin */
gs_plugin_loader_run_adopt (helper->plugin_loader, list);
/* run each plugin */
if (!gs_plugin_loader_run_refine_filter (helper, list,
GS_PLUGIN_REFINE_FLAGS_DEFAULT,
- cancellable, error))
+ cancellable, error)) {
+ if (previous_list != NULL)
+ gs_plugin_job_set_list (helper->plugin_job, previous_list);
return FALSE;
+ }
/* ensure these are sorted by score */
if (gs_plugin_job_has_refine_flags (helper->plugin_job,
@@ -983,6 +993,8 @@ gs_plugin_loader_run_refine_internal (GsPluginLoaderHelper *helper,
addons_list,
cancellable,
error)) {
+ if (previous_list != NULL)
+ gs_plugin_job_set_list (helper->plugin_job, previous_list);
return FALSE;
}
}
@@ -1004,6 +1016,8 @@ gs_plugin_loader_run_refine_internal (GsPluginLoaderHelper *helper,
list2,
cancellable,
error)) {
+ if (previous_list != NULL)
+ gs_plugin_job_set_list (helper->plugin_job, previous_list);
return FALSE;
}
}
@@ -1032,11 +1046,16 @@ gs_plugin_loader_run_refine_internal (GsPluginLoaderHelper *helper,
related_list,
cancellable,
error)) {
+ if (previous_list != NULL)
+ gs_plugin_job_set_list (helper->plugin_job, previous_list);
return FALSE;
}
}
}
+ if (previous_list != NULL)
+ gs_plugin_job_set_list (helper->plugin_job, previous_list);
+
/* success */
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]