[gnome-photos/wip/rishi/dlna-renderer-fixes-00: 2/3] dlna-renderer: Don't fail photos_dlna_renderer_unshare without an error




commit 2f998a4bd0455e88c324991763c302166c0dced7
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Mar 23 23:31:20 2021 +0100

    dlna-renderer: Don't fail photos_dlna_renderer_unshare without an error
    
    The convention for GIO-style asynchronous APIs is to set an error when
    returning a value that indicates a failure. In this case, returning
    FALSE without setting an error would violate that.
    
    There are some known exceptions to this convention, like
    tracker_sparql_cursor_next, but those conditions don't apply here and
    following the convention will avoid surprising the caller.
    
    https://gitlab.gnome.org/GNOME/gnome-photos/-/merge_requests/196

 src/photos-dlna-renderer.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/src/photos-dlna-renderer.c b/src/photos-dlna-renderer.c
index 56ab6a77..6842245e 100644
--- a/src/photos-dlna-renderer.c
+++ b/src/photos-dlna-renderer.c
@@ -528,7 +528,6 @@ photos_dlna_renderer_unshare_remove_file_cb (GObject *source_object,
   g_autoptr (GTask) task = G_TASK (user_data);
   PhotosDlnaRenderer *self = PHOTOS_DLNA_RENDERER (g_task_get_source_object (task));
   PhotosBaseItem *item;
-  gboolean success = TRUE;
 
   item = g_object_get_data (G_OBJECT (task), "item");
   g_hash_table_foreach_remove (self->urls_to_item, photos_dlna_renderer_match_by_item_value, item);
@@ -545,11 +544,10 @@ photos_dlna_renderer_unshare_remove_file_cb (GObject *source_object,
          * DBus service having been restarted.
          */
         g_warning ("Failed to call the RemoveFile method: %s", error->message);
-        success = FALSE;
       }
   }
 
-  g_task_return_boolean (task, success);
+  g_task_return_boolean (task, TRUE);
 }
 
 


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