[gnome-software/wip/hughsie/runtime-update] Do not cause a explosion when updating gnome-software on a mutable system



commit 45f5932af46962ee7b381e1321685951505f2715
Author: Richard Hughes <richard hughsie com>
Date:   Thu Feb 28 14:53:24 2019 +0000

    Do not cause a explosion when updating gnome-software on a mutable system
    
    We only need to do the notification once, rather than wildcard refining the
    org.gnome.Software GsApp for each inotify event.

 lib/gs-plugin-loader.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index d132edb6..ca0504a3 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -34,6 +34,7 @@ typedef struct
        GPtrArray               *locations;
        gchar                   *locale;
        gchar                   *language;
+       gboolean                 plugin_dir_dirty;
        SoupSession             *soup_session;
        GPtrArray               *auth_array;
        GPtrArray               *file_monitors;
@@ -2168,10 +2169,15 @@ gs_plugin_loader_plugin_dir_changed_cb (GFileMonitor *monitor,
                                        GFileMonitorEvent event_type,
                                        GsPluginLoader *plugin_loader)
 {
+       GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
        g_autoptr(GsApp) app = NULL;
        g_autoptr(GsPluginEvent) event = gs_plugin_event_new ();
        g_autoptr(GError) error = NULL;
 
+       /* already triggered */
+       if (priv->plugin_dir_dirty)
+               return;
+
        /* add app */
        gs_plugin_event_set_action (event, GS_PLUGIN_ACTION_SETUP);
        app = gs_plugin_loader_app_create (plugin_loader,
@@ -2186,6 +2192,7 @@ gs_plugin_loader_plugin_dir_changed_cb (GFileMonitor *monitor,
                             "A restart is required");
        gs_plugin_event_set_error (event, error);
        gs_plugin_loader_add_event (plugin_loader, event);
+       priv->plugin_dir_dirty = TRUE;
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]