[gnome-photos/wip/rishi/dlna-renderer-fixes-01: 3/3] dlna-renderer: Make the reference counting more explicit




commit dd10384b06855aacffa6c18d0754f52968602311
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Mar 24 00:19:14 2021 +0100

    dlna-renderer: Make the reference counting more explicit
    
    https://gitlab.gnome.org/GNOME/gnome-photos/-/merge_requests/197

 src/photos-dlna-renderer.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/photos-dlna-renderer.c b/src/photos-dlna-renderer.c
index 4b6aff28..8b358fd6 100644
--- a/src/photos-dlna-renderer.c
+++ b/src/photos-dlna-renderer.c
@@ -488,12 +488,12 @@ photos_dlna_renderer_share (PhotosDlnaRenderer *self,
                             GAsyncReadyCallback callback,
                             gpointer user_data)
 {
-  GTask *task;
+  g_autoptr (GTask) task = NULL;
 
   task = g_task_new (self, cancellable, callback, user_data);
   g_object_set_data_full (G_OBJECT (task), "item", g_object_ref (item), g_object_unref);
 
-  photos_base_item_download_async (item, cancellable, photos_dlna_renderer_share_download_cb, task);
+  photos_base_item_download_async (item, cancellable, photos_dlna_renderer_share_download_cb, g_object_ref 
(task));
 }
 
 
@@ -589,12 +589,15 @@ photos_dlna_renderer_unshare (PhotosDlnaRenderer *self,
                               GAsyncReadyCallback callback,
                               gpointer user_data)
 {
-  GTask *task;
+  g_autoptr (GTask) task = NULL;
 
   task = g_task_new (self, cancellable, callback, user_data);
   g_object_set_data_full (G_OBJECT (task), "item", g_object_ref (item), g_object_unref);
 
-  photos_base_item_download_async (item, cancellable, photos_dlna_renderer_unshare_download_cb, task);
+  photos_base_item_download_async (item,
+                                   cancellable,
+                                   photos_dlna_renderer_unshare_download_cb,
+                                   g_object_ref (task));
 }
 
 
@@ -749,14 +752,14 @@ photos_dlna_renderer_get_icon (PhotosDlnaRenderer *self,
                                GAsyncReadyCallback callback,
                                gpointer user_data)
 {
-  GTask *task;
+  g_autoptr (GTask) task = NULL;
 
   task = g_task_new (self, cancellable, callback, user_data);
   g_task_set_task_data (task, GINT_TO_POINTER (size), NULL);
 
   dleyna_renderer_device_call_get_icon (self->device, requested_mimetype, resolution,
                                         cancellable, photos_dlna_renderer_device_get_icon_cb,
-                                        task);
+                                        g_object_ref (task));
 }
 
 


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