Commit 2ae2c443 authored by Cosimo Cecchi's avatar Cosimo Cecchi

app-chooser-dialog: cancel the PK operation when the dialog is dismissed

This doesn't really seem to have any effect; probably PK doesn't listen
for changes on the passed-in cancellable, but it's correct.

Related to: https://bugzilla.gnome.org/show_bug.cgi?id=649121
parent 623b5192
......@@ -146,6 +146,7 @@ search_for_mimetype_ready_cb (GObject *source,
}
out:
g_clear_object (&self->priv->online_cancellable);
g_clear_error (&error);
g_object_unref (self);
......@@ -296,6 +297,16 @@ add_or_find_application (GtkAppChooserDialog *self)
}
}
static void
cancel_and_clear_cancellable (GtkAppChooserDialog *self)
{
if (self->priv->online_cancellable != NULL)
{
g_cancellable_cancel (self->priv->online_cancellable);
g_clear_object (&self->priv->online_cancellable);
}
}
static void
gtk_app_chooser_dialog_response (GtkDialog *dialog,
gint response_id,
......@@ -310,6 +321,7 @@ gtk_app_chooser_dialog_response (GtkDialog *dialog,
break;
case GTK_RESPONSE_CANCEL:
case GTK_RESPONSE_DELETE_EVENT:
cancel_and_clear_cancellable (self);
self->priv->dismissed = TRUE;
default :
break;
......@@ -631,14 +643,9 @@ gtk_app_chooser_dialog_dispose (GObject *object)
GtkAppChooserDialog *self = GTK_APP_CHOOSER_DIALOG (object);
g_clear_object (&self->priv->gfile);
cancel_and_clear_cancellable (self);
g_clear_object (&self->priv->online);
if (self->priv->online_cancellable != NULL)
{
g_cancellable_cancel (self->priv->online_cancellable);
g_clear_object (&self->priv->online_cancellable);
}
G_OBJECT_CLASS (gtk_app_chooser_dialog_parent_class)->dispose (object);
}
......
......@@ -118,6 +118,7 @@ install_mime_types_ready_cb (GObject *source,
}
g_simple_async_result_complete (self->priv->result);
g_clear_object (&self->priv->result);
}
static void
......
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