[gnome-software/gnome-3-30] updates page: trivial: Fix a critical when removing apps



commit 435fecb82a552d4027c147d27f949ff8e44ebb43
Author: Kalev Lember <klember redhat com>
Date:   Wed Oct 17 18:05:54 2018 +0200

    updates page: trivial: Fix a critical when removing apps
    
    Guard against NULL app in plugin loader status-changed callback.
    
    We don't always get the app as plugins are allowed to leave it at NULL.
    In particular, the way packagekit status updates are currently hooked up
    means that we don't get the app for remove operations.

 src/gs-updates-page.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-updates-page.c b/src/gs-updates-page.c
index e8b44230..9ce8ef7d 100644
--- a/src/gs-updates-page.c
+++ b/src/gs-updates-page.c
@@ -1249,8 +1249,9 @@ gs_updates_page_status_changed_cb (GsPluginLoader *plugin_loader,
        switch (status) {
        case GS_PLUGIN_STATUS_INSTALLING:
        case GS_PLUGIN_STATUS_REMOVING:
-               if (gs_app_get_kind (app) != AS_APP_KIND_OS_UPGRADE &&
-                   gs_app_get_id (app) != NULL) {
+               if (app == NULL ||
+                   (gs_app_get_kind (app) != AS_APP_KIND_OS_UPGRADE &&
+                    gs_app_get_id (app) != NULL)) {
                        /* if we do a install or remove then make sure all new
                         * packages are downloaded */
                        gs_updates_page_invalidate_downloaded_upgrade (self);


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