[gnome-software] sources dialog: Don't crash when closing the dialog while it's loading



commit a4c175f36fcb974482c86c44a3c6dc009a504692
Author: Kalev Lember <klember redhat com>
Date:   Thu Nov 23 14:09:40 2017 +0100

    sources dialog: Don't crash when closing the dialog while it's loading
    
    Avoid accessing any private data in get_sources_cb() when we get the
    callback after the dialog has been destroyed.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1468417

 src/gs-sources-dialog.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-sources-dialog.c b/src/gs-sources-dialog.c
index 862619e..db218dc 100644
--- a/src/gs-sources-dialog.c
+++ b/src/gs-sources-dialog.c
@@ -316,9 +316,6 @@ get_sources_cb (GsPluginLoader *plugin_loader,
        g_autoptr(GError) error = NULL;
        g_autoptr(GsAppList) list = NULL;
 
-       /* show results */
-       gs_stop_spinner (GTK_SPINNER (dialog->spinner));
-
        /* get the results */
        list = gs_plugin_loader_job_process_finish (plugin_loader, res, &error);
        if (list == NULL) {
@@ -326,6 +323,7 @@ get_sources_cb (GsPluginLoader *plugin_loader,
                                     GS_PLUGIN_ERROR,
                                     GS_PLUGIN_ERROR_CANCELLED)) {
                        g_debug ("get sources cancelled");
+                       return;
                } else {
                        g_warning ("failed to get sources: %s", error->message);
                }
@@ -335,6 +333,9 @@ get_sources_cb (GsPluginLoader *plugin_loader,
                return;
        }
 
+       /* stop the spinner */
+       gs_stop_spinner (GTK_SPINNER (dialog->spinner));
+
        /* no results */
        if (gs_app_list_length (list) == 0) {
                g_debug ("no sources to show");


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