[gtk+] printing: Increase reference count for user data



commit abf1c57bd0e472eedbd174210d935a1c3ad01a6d
Author: Marek Kasik <mkasik redhat com>
Date:   Mon Mar 12 12:36:50 2012 +0100

    printing: Increase reference count for user data
    
    Increase reference count for data passed to colord's callbacks (#671419).

 modules/printbackends/cups/gtkprintercups.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/modules/printbackends/cups/gtkprintercups.c b/modules/printbackends/cups/gtkprintercups.c
index 154b23f..e8c652f 100644
--- a/modules/printbackends/cups/gtkprintercups.c
+++ b/modules/printbackends/cups/gtkprintercups.c
@@ -276,6 +276,8 @@ colord_client_profile_connect_cb (GObject *source_object,
 
   /* update the UI */
   colord_update_ui_from_settings (printer);
+
+  g_object_unref (printer);
 }
 
 static void
@@ -303,10 +305,12 @@ colord_client_device_get_profile_for_qualifiers_cb (GObject *source_object,
   cd_profile_connect (printer->colord_profile,
                       printer->colord_cancellable,
                       colord_client_profile_connect_cb,
-                      printer);
+                      g_object_ref (printer));
 out:
   /* update the UI */
   colord_update_ui_from_settings (printer);
+
+  g_object_unref (printer);
 }
 
 void
@@ -364,7 +368,7 @@ gtk_printer_cups_update_settings (GtkPrinterCups *printer,
                                         (const gchar **) qualifiers,
                                         printer->colord_cancellable,
                                         colord_client_device_get_profile_for_qualifiers_cb,
-                                        printer);
+                                        g_object_ref (printer));
 
   /* save for the future */
   g_free (printer->colord_qualifier);
@@ -398,6 +402,8 @@ colord_client_device_connect_cb (GObject *source_object,
 out:
   /* update the UI */
   colord_update_ui_from_settings (printer);
+
+  g_object_unref (printer);
 }
 
 static void
@@ -425,10 +431,12 @@ colord_client_find_device_cb (GObject *source_object,
   cd_device_connect (printer->colord_device,
                      printer->colord_cancellable,
                      colord_client_device_connect_cb,
-                     printer);
+                     g_object_ref (printer));
 out:
   /* update the UI */
   colord_update_ui_from_settings (printer);
+
+  g_object_unref (printer);
 }
 
 static void
@@ -466,7 +474,7 @@ colord_update_device (GtkPrinterCups *printer)
                          colord_device_id,
                          printer->colord_cancellable,
                          colord_client_find_device_cb,
-                         printer);
+                         g_object_ref (printer));
 out:
   g_free (colord_device_id);
 
@@ -493,6 +501,8 @@ colord_client_connect_cb (GObject *source_object,
 
   /* refresh the device */
   colord_update_device (printer);
+
+  g_object_unref (printer);
 }
 #endif
 
@@ -537,7 +547,7 @@ gtk_printer_cups_new (const char      *name,
       cd_client_connect (printer->colord_client,
                          printer->colord_cancellable,
                          colord_client_connect_cb,
-                         printer);
+                         g_object_ref (printer));
     }
 #endif
   return printer;



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