[gnome-software/wip/automatic-update-fixes] plugin-loader: Change how updates-checked is scheduled for emission



commit 1ea037fd6b96f6a730c30a5596703eb118cb5f8d
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jun 15 17:58:32 2022 +0200

    plugin-loader: Change how updates-checked is scheduled for emission
    
    This way the GSource can be removed without leaking the plugin loader.

 lib/gs-plugin-loader.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index cfde97e17..49b7fded3 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -1753,7 +1753,7 @@ gs_plugin_loader_ask_untrusted_cb (GsPlugin *plugin,
 }
 
 static gboolean
-gs_plugin_loader_job_actions_changed_delay_cb (gpointer user_data)
+gs_plugin_loader_job_updates_changed_delay_cb (gpointer user_data)
 {
        GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (user_data);
 
@@ -1763,7 +1763,6 @@ gs_plugin_loader_job_actions_changed_delay_cb (gpointer user_data)
        plugin_loader->updates_changed_id = 0;
        plugin_loader->updates_changed_cnt = 0;
 
-       g_object_unref (plugin_loader);
        return FALSE;
 }
 
@@ -1773,9 +1772,11 @@ gs_plugin_loader_updates_changed (GsPluginLoader *plugin_loader)
        if (plugin_loader->updates_changed_id != 0)
                return;
        plugin_loader->updates_changed_id =
-               g_timeout_add_seconds (GS_PLUGIN_LOADER_UPDATES_CHANGED_DELAY,
-                                      gs_plugin_loader_job_actions_changed_delay_cb,
-                                      g_object_ref (plugin_loader));
+               g_timeout_add_seconds_full (G_PRIORITY_DEFAULT,
+                                           GS_PLUGIN_LOADER_UPDATES_CHANGED_DELAY,
+                                           gs_plugin_loader_job_updates_changed_delay_cb,
+                                           g_object_ref (plugin_loader),
+                                           g_object_unref);
 }
 
 static void


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