[gnome-software] Improve failure code path when install or remove fails



commit ee114a1b5f2ef0908280e6ef7c932cadca3ca25a
Author: Kalev Lember <klember redhat com>
Date:   Sat Aug 8 17:39:46 2015 +0200

    Improve failure code path when install or remove fails
    
    Avoid calling callbacks when install or remove fails, and also make sure
    we don't leak InstallRemoveData in that case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748694

 src/gs-page.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-page.c b/src/gs-page.c
index 0a1917f..c3790e7 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -78,7 +78,7 @@ gs_page_app_installed_cb (GObject *source,
                                            gs_shell_get_window (priv->shell),
                                            GS_PLUGIN_LOADER_ACTION_INSTALL,
                                            error);
-               return;
+               goto out;
        }
 
        /* only show this if the window is not active */
@@ -89,6 +89,7 @@ gs_page_app_installed_cb (GObject *source,
        if (GS_PAGE_GET_CLASS (page)->app_installed != NULL)
                GS_PAGE_GET_CLASS (page)->app_installed (page, data->app);
 
+out:
        install_remove_data_free (data);
 }
 
@@ -113,11 +114,13 @@ gs_page_app_removed_cb (GObject *source,
                                            gs_shell_get_window (priv->shell),
                                            GS_PLUGIN_LOADER_ACTION_REMOVE,
                                            error);
+               goto out;
        }
 
        if (GS_PAGE_GET_CLASS (page)->app_removed != NULL)
                GS_PAGE_GET_CLASS (page)->app_removed (page, data->app);
 
+out:
        install_remove_data_free (data);
 }
 


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