[gnome-software/wip/flatpak-broken-remotes-table] flatpak: Invalidate local caches immediately before calling reload
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/flatpak-broken-remotes-table] flatpak: Invalidate local caches immediately before calling reload
- Date: Tue, 12 Apr 2022 11:50:33 +0000 (UTC)
commit 2dc6b20f09a3b8352870bc60ad2431c21fad23d2
Author: Milan Crha <mcrha redhat com>
Date: Tue Apr 12 13:42:33 2022 +0200
flatpak: Invalidate local caches immediately before calling reload
The split between invalidating the local cache and when the plugin
is reload could have cause, theoretically, a race condition when
the notification of the change of the flatpak installation is received
while the internal flatpak instance is busy.
plugins/flatpak/gs-flatpak.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index b67bc91e9..dd528cc26 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -451,22 +451,6 @@ static gboolean
gs_flatpak_claim_changed_idle_cb (gpointer user_data)
{
GsFlatpak *self = user_data;
-
- self->requires_full_rescan = TRUE;
-
- gs_plugin_cache_invalidate (self->plugin);
- gs_plugin_reload (self->plugin);
-
- return G_SOURCE_REMOVE;
-}
-
-static void
-gs_plugin_flatpak_changed_cb (GFileMonitor *monitor,
- GFile *child,
- GFile *other_file,
- GFileMonitorEvent event_type,
- GsFlatpak *self)
-{
g_autoptr(GError) error = NULL;
g_autoptr(GMutexLocker) locker = NULL;
g_autoptr(GRWLockWriterLocker) writer_locker = NULL;
@@ -486,6 +470,21 @@ gs_plugin_flatpak_changed_cb (GFileMonitor *monitor,
xb_silo_invalidate (self->silo);
g_clear_pointer (&writer_locker, g_rw_lock_writer_locker_free);
+ self->requires_full_rescan = TRUE;
+
+ gs_plugin_cache_invalidate (self->plugin);
+ gs_plugin_reload (self->plugin);
+
+ return G_SOURCE_REMOVE;
+}
+
+static void
+gs_plugin_flatpak_changed_cb (GFileMonitor *monitor,
+ GFile *child,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
+ GsFlatpak *self)
+{
if (gs_flatpak_get_busy (self)) {
self->changed_while_busy = TRUE;
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]