[gnome-documents/gnome-3-20] utils: Simplify the clean-up
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/gnome-3-20] utils: Simplify the clean-up
- Date: Tue, 20 Jun 2017 08:32:39 +0000 (UTC)
commit 72ef997128bccbee2055a10ac0d332040020a469
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Mar 31 20:16:05 2017 +0200
utils: Simplify the clean-up
It's more readable to unconditionally initialize everything that needs
to be cleaned up, and do the clean up as part of the 'out' stanza. This
is also how g_auto* works, so it brings us a step closer to it.
https://bugzilla.gnome.org/show_bug.cgi?id=780780
src/lib/gd-utils.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/src/lib/gd-utils.c b/src/lib/gd-utils.c
index 0ed952d..5e6254a 100644
--- a/src/lib/gd-utils.c
+++ b/src/lib/gd-utils.c
@@ -41,10 +41,10 @@ create_thumbnail (GIOSchedulerJob *job,
{
GSimpleAsyncResult *result = user_data;
GFile *file = G_FILE (g_async_result_get_source_object (G_ASYNC_RESULT (result)));
- GnomeDesktopThumbnailFactory *factory;
- GFileInfo *info;
+ GnomeDesktopThumbnailFactory *factory = NULL;
+ GFileInfo *info = NULL;
gchar *uri;
- GdkPixbuf *pixbuf;
+ GdkPixbuf *pixbuf = NULL;
guint64 mtime;
uri = g_file_get_uri (file);
@@ -79,15 +79,14 @@ create_thumbnail (GIOSchedulerJob *job,
g_simple_async_result_set_op_res_gboolean (result, FALSE);
}
- g_object_unref (info);
- g_object_unref (file);
- g_object_unref (factory);
- g_clear_object (&pixbuf);
-
out:
g_simple_async_result_complete_in_idle (result);
g_object_unref (result);
+ g_clear_object (&info);
+ g_object_unref (file);
+ g_clear_object (&factory);
+ g_clear_object (&pixbuf);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]