[Spice-devel] [spice-gtk v4 04/24] file-xfer: save GFileInfo for later usage

Victor Toso victortoso at redhat.com
Thu Jun 23 17:37:36 UTC 2016


GFileInfo is currently leaking from file_xfer_info_async_cb() so it
should be fixed. As the GFileInfo is an interesting object to have
for the next patch, I'm saving this object for later usage.

This change is related to split SpiceFileTransferTask from
channel-main.
---
 src/channel-main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/channel-main.c b/src/channel-main.c
index 2bacfb2..1411fb3 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -101,6 +101,7 @@ struct _SpiceFileTransferTask
     gpointer                       user_data;
     char                           *buffer;
     uint64_t                       read_bytes;
+    GFileInfo                      *file_info;
     uint64_t                       file_size;
     gint64                         start_time;
     gint64                         last_update;
@@ -3041,6 +3042,7 @@ static void file_xfer_info_async_cb(GObject *obj, GAsyncResult *res, gpointer da
     if (error || self->error)
         goto failed;
 
+    self->file_info = info;
     self->file_size =
         g_file_info_get_attribute_uint64(info, G_FILE_ATTRIBUTE_STANDARD_SIZE);
     g_object_notify(G_OBJECT(self), "progress");
@@ -3351,6 +3353,7 @@ spice_file_transfer_task_dispose(GObject *object)
     SpiceFileTransferTask *self = SPICE_FILE_TRANSFER_TASK(object);
 
     g_clear_object(&self->file);
+    g_clear_object(&self->file_info);
 
     G_OBJECT_CLASS(spice_file_transfer_task_parent_class)->dispose(object);
 }
-- 
2.7.4



More information about the Spice-devel mailing list