[gnome-control-center] printers: Use g_autoptr with GThread



commit ad226b420c656a055602136ff1feaa6ba919d039
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Oct 30 11:41:49 2020 +1300

    printers: Use g_autoptr with GThread

 panels/printers/pp-utils.c | 32 ++++++--------------------------
 1 file changed, 6 insertions(+), 26 deletions(-)
---
diff --git a/panels/printers/pp-utils.c b/panels/printers/pp-utils.c
index ef11053e1..f496fa7fb 100644
--- a/panels/printers/pp-utils.c
+++ b/panels/printers/pp-utils.c
@@ -1335,7 +1335,7 @@ get_ipp_attributes_async (const gchar  *printer_name,
                           gpointer      user_data)
 {
   GIAData          *data;
-  GThread          *thread;
+  g_autoptr(GThread) thread = NULL;
   g_autoptr(GError) error = NULL;
 
   data = g_new0 (GIAData, 1);
@@ -1357,10 +1357,6 @@ get_ipp_attributes_async (const gchar  *printer_name,
 
       get_ipp_attributes_data_free (data);
     }
-  else
-    {
-      g_thread_unref (thread);
-    }
 }
 
 IPPAttribute *
@@ -1734,7 +1730,7 @@ get_ppds_attribute_async (gchar       **ppds_names,
                           gpointer      user_data)
 {
   GPAData          *data;
-  GThread          *thread;
+  g_autoptr(GThread) thread = NULL;
   g_autoptr(GError) error = NULL;
 
   if (!ppds_names || !attribute_name)
@@ -1762,10 +1758,6 @@ get_ppds_attribute_async (gchar       **ppds_names,
 
       get_ppds_attribute_data_free (data);
     }
-  else
-    {
-      g_thread_unref (thread);
-    }
 }
 
 
@@ -2718,8 +2710,8 @@ get_all_ppds_async (GCancellable *cancellable,
                     gpointer      user_data)
 {
   GAPData          *data;
-  GThread          *thread;
-  g_autoptr(GError) error = NULL;
+  g_autoptr(GThread) thread;
+  g_autoptr(GError)  error = NULL;
 
   data = g_new0 (GAPData, 1);
   if (cancellable)
@@ -2740,10 +2732,6 @@ get_all_ppds_async (GCancellable *cancellable,
 
       get_all_ppds_data_free (data);
     }
-  else
-    {
-      g_thread_unref (thread);
-    }
 }
 
 PPDList *
@@ -2926,7 +2914,7 @@ printer_get_ppd_async (const gchar *printer_name,
                        gpointer     user_data)
 {
   PGPData          *data;
-  GThread          *thread;
+  g_autoptr(GThread) thread = NULL;
   g_autoptr(GError) error = NULL;
 
   data = g_new0 (PGPData, 1);
@@ -2949,10 +2937,6 @@ printer_get_ppd_async (const gchar *printer_name,
 
       printer_get_ppd_data_free (data);
     }
-  else
-    {
-      g_thread_unref (thread);
-    }
 }
 
 typedef struct
@@ -3018,7 +3002,7 @@ get_named_dest_async (const gchar *printer_name,
                       gpointer     user_data)
 {
   GNDData          *data;
-  GThread          *thread;
+  g_autoptr(GThread) thread = NULL;
   g_autoptr(GError) error = NULL;
 
   data = g_new0 (GNDData, 1);
@@ -3039,10 +3023,6 @@ get_named_dest_async (const gchar *printer_name,
 
       get_named_dest_data_free (data);
     }
-  else
-    {
-      g_thread_unref (thread);
-    }
 }
 
 typedef struct


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