Simplify use of GCancellable

g_cancellable_cancell can be called without checking for a NULL value.
Use g_clear_object instead of g_object_unref
This commit is contained in:
Robert Ancell 2018-05-31 10:16:54 +12:00 committed by Georges Basile Stavracas Neto
parent dd61d98ec5
commit a64ef75ad7
9 changed files with 23 additions and 54 deletions

View file

@ -462,18 +462,11 @@ pp_details_dialog_free (PpDetailsDialog *self)
self->all_ppds_list = NULL;
}
if (self->get_all_ppds_cancellable != NULL)
{
g_cancellable_cancel (self->get_all_ppds_cancellable);
g_clear_object (&self->get_all_ppds_cancellable);
}
g_cancellable_cancel (self->get_all_ppds_cancellable);
g_clear_object (&self->get_all_ppds_cancellable);
if (self->get_ppd_names_cancellable != NULL)
{
g_cancellable_cancel (self->get_ppd_names_cancellable);
g_object_unref (self->get_ppd_names_cancellable);
self->get_ppd_names_cancellable = NULL;
}
g_cancellable_cancel (self->get_ppd_names_cancellable);
g_clear_object (&self->get_ppd_names_cancellable);
gtk_widget_destroy (GTK_WIDGET (self));
}