[gnome-photos] remote-display-manager: Avoid unref'ing NULL in case of errors



commit 3f01ccd86aecbb63be49f21128db9b1c198b5218
Author: Emanuele Aina <emanuele aina collabora com>
Date:   Sat Aug 3 15:33:18 2013 +0200

    remote-display-manager: Avoid unref'ing NULL in case of errors
    
    In case of error photos_dlna_renderer_share_finish() returns NULL, so
    it's better to call _unref() only after checking the error status.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705435

 src/photos-remote-display-manager.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-remote-display-manager.c b/src/photos-remote-display-manager.c
index 69d013d..29a25df 100644
--- a/src/photos-remote-display-manager.c
+++ b/src/photos-remote-display-manager.c
@@ -176,18 +176,18 @@ photos_remote_display_manager_share_cb (GObject      *source_object,
   GError *error = NULL;
 
   item = photos_dlna_renderer_share_finish (renderer, res, &error);
-  g_object_unref (item); /* We already hold a ref to the item to be shared */
 
   if (error != NULL)
     {
       g_warning ("Unable to remotely display item '%s': %s",
-                 item != NULL ? photos_base_item_get_id (item) : "(none)",
+                 share->item != NULL ? photos_base_item_get_id (share->item) : "(none)",
                  error->message);
       g_signal_emit (share->manager, signals[SHARE_ERROR], 0, share->renderer, share->item, error);
       g_error_free (error);
       goto out;
     }
 
+  g_object_unref (item); /* We already hold a ref to the item to be shared */
   g_signal_emit (share->manager, signals[SHARE_BEGAN], 0, share->renderer, share->item);
 
 out:


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