[gnome-software] trivial: Do not create a GsApp when emitting global status



commit cbeb52391cfa1c37aac87b2c4eeb82d94d7ed07d
Author: Richard Hughes <richard hughsie com>
Date:   Wed Feb 22 19:48:17 2017 +0000

    trivial: Do not create a GsApp when emitting global status

 src/gs-plugin-loader.c |    2 +-
 src/gs-plugin.c        |    7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index acb00fd..9e4bafa 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -3296,7 +3296,7 @@ gs_plugin_loader_status_changed_cb (GsPlugin *plugin,
        GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
 
        /* nothing specific */
-       if (gs_app_get_id (app) == NULL) {
+       if (app == NULL || gs_app_get_id (app) == NULL) {
                if (priv->global_status_last != status) {
                        g_debug ("emitting global %s",
                                 gs_plugin_status_to_string (status));
diff --git a/src/gs-plugin.c b/src/gs-plugin.c
index 879d5da..e4fdc2e 100644
--- a/src/gs-plugin.c
+++ b/src/gs-plugin.c
@@ -923,7 +923,8 @@ gs_plugin_status_update_cb (gpointer user_data)
                       signals[SIGNAL_STATUS_CHANGED], 0,
                       helper->app,
                       helper->status);
-       g_object_unref (helper->app);
+       if (helper->app != NULL)
+               g_object_unref (helper->app);
        g_slice_free (GsPluginStatusHelper, helper);
        return FALSE;
 }
@@ -945,9 +946,7 @@ gs_plugin_status_update (GsPlugin *plugin, GsApp *app, GsPluginStatus status)
        helper = g_slice_new0 (GsPluginStatusHelper);
        helper->plugin = plugin;
        helper->status = status;
-       if (app == NULL)
-               helper->app = gs_app_new (NULL);
-       else
+       if (app != NULL)
                helper->app = g_object_ref (app);
        g_idle_add (gs_plugin_status_update_cb, helper);
 }


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