Commit 70719760 authored by Kalev Lember's avatar Kalev Lember

update dialog: Avoid crashing when the dialog is quickly closed

Be more careful to avoid dereferencing priv variables in an async
callback handler, which can be called when the dialog is in dispose and
the priv variables have all already been cleared to NULL.

Note that this needs fixing in many more places, but this particular
crash is a top F30 crasher.

https://bugzilla.redhat.com/show_bug.cgi?id=1634075
parent 8ff12e84
Pipeline #80281 passed with stage
in 27 minutes and 14 seconds
......@@ -245,19 +245,21 @@ get_installed_updates_cb (GsPluginLoader *plugin_loader,
g_autoptr(GsAppList) list = NULL;
g_autoptr(GError) error = NULL;
gs_stop_spinner (GTK_SPINNER (dialog->spinner));
/* get the results */
list = gs_plugin_loader_job_process_finish (plugin_loader, res, &error);
if (list == NULL) {
if (g_error_matches (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_CANCELLED)) {
/* This should only ever happen while the dialog is being closed */
g_debug ("get installed updates cancelled");
return;
}
/* if we're in teardown, short-circuit and return immediately without
* dereferencing priv variables */
if (g_error_matches (error, GS_PLUGIN_ERROR, GS_PLUGIN_ERROR_CANCELLED) ||
dialog->spinner == NULL) {
g_debug ("get installed updates cancelled");
return;
}
gs_stop_spinner (GTK_SPINNER (dialog->spinner));
/* error */
if (list == NULL) {
g_warning ("failed to get installed updates: %s", error->message);
gtk_stack_set_visible_child_name (GTK_STACK (dialog->stack), "empty");
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment