[gnome-software/1422-gnome-software-does-not-realize-it-has-uninstalled-software-allows-it-to-be-uninstalled-again] gs-plugin-appstream: Invalidate the silo after install/update/remove is finished
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1422-gnome-software-does-not-realize-it-has-uninstalled-software-allows-it-to-be-uninstalled-again] gs-plugin-appstream: Invalidate the silo after install/update/remove is finished
- Date: Tue, 14 Sep 2021 15:32:26 +0000 (UTC)
commit 5263d7b18e9fc801fd7380a382eea3da36992b0a
Author: Milan Crha <mcrha redhat com>
Date: Tue Sep 14 17:29:52 2021 +0200
gs-plugin-appstream: Invalidate the silo after install/update/remove is finished
These actions can cause changes on the disk, which are not always
noticed by the XbSilo, thus explicitly request a refresh of the XbSilo
to ensure an up-to-date state is used by this plugin.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1422
plugins/core/gs-plugin-appstream.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index f7b3ae428..b01cb1b4c 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -30,6 +30,7 @@ struct GsPluginData {
XbSilo *silo;
GRWLock silo_lock;
GSettings *settings;
+ gboolean needs_refresh;
};
void
@@ -516,10 +517,12 @@ gs_plugin_appstream_check_silo (GsPlugin *plugin,
reader_locker = g_rw_lock_reader_locker_new (&priv->silo_lock);
/* everything is okay */
- if (priv->silo != NULL && xb_silo_is_valid (priv->silo))
+ if (priv->silo != NULL && !priv->needs_refresh && xb_silo_is_valid (priv->silo))
return TRUE;
g_clear_pointer (&reader_locker, g_rw_lock_reader_locker_free);
+ priv->needs_refresh = FALSE;
+
/* drat! silo needs regenerating */
writer_locker = g_rw_lock_writer_locker_new (&priv->silo_lock);
g_clear_object (&priv->silo);
@@ -1135,3 +1138,15 @@ gs_plugin_refresh (GsPlugin *plugin,
{
return gs_plugin_appstream_check_silo (plugin, cancellable, error);
}
+
+void
+gs_plugin_action_finished (GsPlugin *plugin,
+ GsPluginAction action)
+{
+ if (action == GS_PLUGIN_ACTION_INSTALL ||
+ action == GS_PLUGIN_ACTION_REMOVE ||
+ action == GS_PLUGIN_ACTION_UPDATE) {
+ GsPluginData *priv = gs_plugin_get_data (plugin);
+ priv->needs_refresh = TRUE;
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]