[gnome-photos] glib: Use g_auto* with custom closures
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] glib: Use g_auto* with custom closures
- Date: Thu, 7 Dec 2017 10:34:48 +0000 (UTC)
commit e31095dcd81e786b9a895e68fcd3c4ea44ab957b
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Dec 5 12:09:51 2017 +0100
glib: Use g_auto* with custom closures
https://bugzilla.gnome.org/show_bug.cgi?id=788174
src/photos-glib.c | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/src/photos-glib.c b/src/photos-glib.c
index dd635c2..61e0eed 100644
--- a/src/photos-glib.c
+++ b/src/photos-glib.c
@@ -102,6 +102,9 @@ photos_glib_file_create_data_free (PhotosGLibFileCreateData *data)
}
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotosGLibFileCreateData, photos_glib_file_create_data_free);
+
+
static gchar *
photos_glib_file_create_data_get_filename (PhotosGLibFileCreateData *data)
{
@@ -197,20 +200,15 @@ photos_glib_file_create_async (GFile *file,
gpointer user_data)
{
g_autoptr (GTask) task = NULL;
- PhotosGLibFileCreateData *data;
+ g_autoptr (PhotosGLibFileCreateData) data = NULL;
task = g_task_new (file, cancellable, callback, user_data);
g_task_set_source_tag (task, photos_glib_file_create_async);
data = photos_glib_file_create_data_new (file, flags, io_priority);
- g_task_set_task_data (task, data, (GDestroyNotify) photos_glib_file_create_data_free);
-
- g_file_create_async (file,
- data->flags,
- data->io_priority,
- cancellable,
- photos_glib_file_create_create,
- g_object_ref (task));
+ g_task_set_task_data (task, g_steal_pointer (&data), (GDestroyNotify) photos_glib_file_create_data_free);
+
+ g_file_create_async (file, flags, io_priority, cancellable, photos_glib_file_create_create, g_object_ref
(task));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]