printers: Don't pass ownership in get_all_ppds_async callback

This commit is contained in:
Robert Ancell 2021-02-12 15:13:21 +13:00
parent 98fd38278a
commit 5b086c44e8
3 changed files with 7 additions and 14 deletions

View file

@ -1089,7 +1089,7 @@ get_all_ppds_async_cb (PPDList *ppds,
{
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
self->all_ppds_list = ppds;
self->all_ppds_list = ppd_list_copy (ppds);
if (self->pp_new_printer_dialog)
pp_new_printer_dialog_set_ppd_list (self->pp_new_printer_dialog,

View file

@ -164,7 +164,7 @@ get_all_ppds_async_cb (PPDList *ppds,
{
PpDetailsDialog *self = user_data;
self->all_ppds_list = ppds;
self->all_ppds_list = ppd_list_copy (ppds);
if (self->pp_ppd_selection_dialog)
pp_ppd_selection_dialog_set_ppd_list (self->pp_ppd_selection_dialog,

View file

@ -2396,6 +2396,8 @@ gap_data_new (GCancellable *cancellable, GAPCallback callback, gpointer user_dat
static void
gap_data_free (GAPData *data)
{
if (data->result != NULL)
ppd_list_free (data->result);
g_clear_object (&data->cancellable);
if (data->context)
g_main_context_unref (data->context);
@ -2405,19 +2407,10 @@ gap_data_free (GAPData *data)
static gboolean
get_all_ppds_idle_cb (gpointer user_data)
{
GAPData *data = (GAPData *) user_data;
GAPData *data = user_data;
/* Don't call callback if cancelled */
if (data->cancellable &&
g_cancellable_is_cancelled (data->cancellable))
{
ppd_list_free (data->result);
data->result = NULL;
}
else
{
data->callback (data->result, data->user_data);
}
if (!g_cancellable_is_cancelled (data->cancellable))
data->callback (data->result, data->user_data);
return FALSE;
}