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



commit b0b49530df44d6f8077f32a30b3e005b9f1ee37e
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 71e6b736..95773c60 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]