[gnome-software/wip/jrocha/notify-from-idle: 2/2] Notify apps' property changes from the main loop



commit 176cb24bebab703649f31bb60ad103f33ab89534
Author: Joaquim Rocha <jrocha endlessm com>
Date:   Fri Sep 29 17:50:38 2017 +0200

    Notify apps' property changes from the main loop
    
    These changes avoid a race when apps are refined from within a
    different thread, as their properties' notification were being
    emitted (and thus triggering) code from those.
    
    Specifically there was a race when setting up the CSS for the
    background tile as this code was not getting run from the main
    loop.

 lib/gs-plugin-loader.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 5ab5bcc8..dd08f9bc 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -955,6 +955,15 @@ gs_plugin_loader_run_refine_internal (GsPluginLoaderHelper *helper,
        return TRUE;
 }
 
+static gboolean
+app_thaw_notify_idle (gpointer data)
+{
+       GsApp *app = GS_APP (data);
+       g_object_thaw_notify (G_OBJECT (app));
+       g_object_unref (app);
+       return G_SOURCE_REMOVE;
+}
+
 static gboolean
 gs_plugin_loader_run_refine (GsPluginLoaderHelper *helper,
                             GsAppList *list,
@@ -1039,7 +1048,7 @@ out:
        /* now emit all the changed signals */
        for (guint i = 0; i < gs_app_list_length (freeze_list); i++) {
                GsApp *app = gs_app_list_index (freeze_list, i);
-               g_object_thaw_notify (G_OBJECT (app));
+               g_idle_add (app_thaw_notify_idle, g_object_ref (app));
        }
        return ret;
 }


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