]> Pileus Git - ~andy/gtk/commitdiff
printing: Increase reference count for user data
authorMarek Kasik <mkasik@redhat.com>
Mon, 12 Mar 2012 11:36:50 +0000 (12:36 +0100)
committerMarek Kasik <mkasik@redhat.com>
Mon, 12 Mar 2012 11:36:50 +0000 (12:36 +0100)
Increase reference count for data passed to colord's callbacks (#671419).

modules/printbackends/cups/gtkprintercups.c

index 154b23fcfc47e268b07667027a18bd12f584778e..e8c652f426a59cb40085cf917e74ba18ef6931f8 100644 (file)
@@ -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;