printers: Don't pass ownership in get_all_ppds_async callback
This commit is contained in:
parent
98fd38278a
commit
5b086c44e8
3 changed files with 7 additions and 14 deletions
|
@ -1089,7 +1089,7 @@ get_all_ppds_async_cb (PPDList *ppds,
|
||||||
{
|
{
|
||||||
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
|
CcPrintersPanel *self = (CcPrintersPanel*) user_data;
|
||||||
|
|
||||||
self->all_ppds_list = ppds;
|
self->all_ppds_list = ppd_list_copy (ppds);
|
||||||
|
|
||||||
if (self->pp_new_printer_dialog)
|
if (self->pp_new_printer_dialog)
|
||||||
pp_new_printer_dialog_set_ppd_list (self->pp_new_printer_dialog,
|
pp_new_printer_dialog_set_ppd_list (self->pp_new_printer_dialog,
|
||||||
|
|
|
@ -164,7 +164,7 @@ get_all_ppds_async_cb (PPDList *ppds,
|
||||||
{
|
{
|
||||||
PpDetailsDialog *self = user_data;
|
PpDetailsDialog *self = user_data;
|
||||||
|
|
||||||
self->all_ppds_list = ppds;
|
self->all_ppds_list = ppd_list_copy (ppds);
|
||||||
|
|
||||||
if (self->pp_ppd_selection_dialog)
|
if (self->pp_ppd_selection_dialog)
|
||||||
pp_ppd_selection_dialog_set_ppd_list (self->pp_ppd_selection_dialog,
|
pp_ppd_selection_dialog_set_ppd_list (self->pp_ppd_selection_dialog,
|
||||||
|
|
|
@ -2396,6 +2396,8 @@ gap_data_new (GCancellable *cancellable, GAPCallback callback, gpointer user_dat
|
||||||
static void
|
static void
|
||||||
gap_data_free (GAPData *data)
|
gap_data_free (GAPData *data)
|
||||||
{
|
{
|
||||||
|
if (data->result != NULL)
|
||||||
|
ppd_list_free (data->result);
|
||||||
g_clear_object (&data->cancellable);
|
g_clear_object (&data->cancellable);
|
||||||
if (data->context)
|
if (data->context)
|
||||||
g_main_context_unref (data->context);
|
g_main_context_unref (data->context);
|
||||||
|
@ -2405,19 +2407,10 @@ gap_data_free (GAPData *data)
|
||||||
static gboolean
|
static gboolean
|
||||||
get_all_ppds_idle_cb (gpointer user_data)
|
get_all_ppds_idle_cb (gpointer user_data)
|
||||||
{
|
{
|
||||||
GAPData *data = (GAPData *) user_data;
|
GAPData *data = user_data;
|
||||||
|
|
||||||
/* Don't call callback if cancelled */
|
if (!g_cancellable_is_cancelled (data->cancellable))
|
||||||
if (data->cancellable &&
|
data->callback (data->result, data->user_data);
|
||||||
g_cancellable_is_cancelled (data->cancellable))
|
|
||||||
{
|
|
||||||
ppd_list_free (data->result);
|
|
||||||
data->result = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data->callback (data->result, data->user_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue