[gnome-control-center] printers: Don't pass PpNewPrinter references around



commit f42d7cca9ac02d9f9fe428b8bbb945993835b6cf
Author: Robert Ancell <robert ancell canonical com>
Date:   Sat Jun 27 10:42:41 2020 +1200

    printers: Don't pass PpNewPrinter references around
    
    An internal GTask will hold a reference to it for the duration of the async calls.

 panels/printers/pp-new-printer-dialog.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/panels/printers/pp-new-printer-dialog.c b/panels/printers/pp-new-printer-dialog.c
index 175b6bb1d..e05a95ddf 100644
--- a/panels/printers/pp-new-printer-dialog.c
+++ b/panels/printers/pp-new-printer-dialog.c
@@ -1865,12 +1865,10 @@ printer_add_async_cb (GObject      *source_object,
 {
   PpNewPrinterDialog        *self = user_data;
   GtkResponseType            response_id = GTK_RESPONSE_OK;
-  PpNewPrinter              *new_printer = (PpNewPrinter *) source_object;
   gboolean                   success;
   g_autoptr(GError)          error = NULL;
 
-  success = pp_new_printer_add_finish (new_printer, res, &error);
-  g_object_unref (source_object);
+  success = pp_new_printer_add_finish (PP_NEW_PRINTER (source_object), res, &error);
 
   if (success)
     {
@@ -1895,7 +1893,7 @@ ppd_selection_cb (GtkDialog *_dialog,
                   gpointer   user_data)
 {
   PpNewPrinterDialog        *self = user_data;
-  PpNewPrinter              *new_printer;
+  g_autoptr(PpNewPrinter)    new_printer = NULL;
   GList                     *original_names_list = NULL;
   gchar                     *ppd_name;
   gchar                     *ppd_display_name;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]