[gnome-photos] base-item: Style fixes



commit 6c5e0bad0185362cc4c1d66e2ba772da5fafa11f
Author: Debarshi Ray <debarshir gnome org>
Date:   Sun Feb 28 23:40:29 2016 +0100

    base-item: Style fixes
    
    It is better to keep the ref/unref and dup/free pairs as tightly
    coupled and explicit as possible - it is more obvious and will work
    better with g_autoptr.

 src/photos-base-item.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 44a05f9..6b145a7 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -488,7 +488,7 @@ photos_base_item_download_in_thread_func (GTask *task,
   PhotosBaseItem *self = PHOTOS_BASE_ITEM (source_object);
   PhotosBaseItemPrivate *priv = self->priv;
   GError *error;
-  gchar *path;
+  gchar *path = NULL;
 
   g_mutex_lock (&priv->mutex_download);
 
@@ -500,9 +500,10 @@ photos_base_item_download_in_thread_func (GTask *task,
       goto out;
     }
 
-  g_task_return_pointer (task, path, g_free);
+  g_task_return_pointer (task, g_strdup (path), g_free);
 
  out:
+  g_free (path);
   g_mutex_unlock (&priv->mutex_download);
 }
 
@@ -794,7 +795,7 @@ photos_base_item_load_buffer_in_thread_func (GTask *task,
 {
   PhotosBaseItem *self = PHOTOS_BASE_ITEM (source_object);
   PhotosBaseItemPrivate *priv = self->priv;
-  GeglBuffer *buffer;
+  GeglBuffer *buffer = NULL;
   GError *error = NULL;
 
   g_mutex_lock (&priv->mutex);
@@ -806,9 +807,10 @@ photos_base_item_load_buffer_in_thread_func (GTask *task,
       goto out;
     }
 
-  g_task_return_pointer (task, buffer, g_object_unref);
+  g_task_return_pointer (task, g_object_ref (buffer), g_object_unref);
 
  out:
+  g_clear_object (&buffer);
   g_mutex_unlock (&priv->mutex);
 }
 


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