[gnome-maps/wip/mlundblad/fix-local-tiles: 1/3] file-data-source: Read content bytes into the correct object




commit 74aafe6dbcb1eacca66fb6f35b6e22efd7d16cd4
Author: Marcus Lundblad <ml dfupdate se>
Date:   Tue Sep 13 23:08:33 2022 +0200

    file-data-source: Read content bytes into the correct object
    
    Store the file byte contents into the task data structure.
    The bytes were actually stored in a local bytes object,
    resulting in null being passed to the renderer.

 lib/maps-file-data-source.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/lib/maps-file-data-source.c b/lib/maps-file-data-source.c
index 2e326f58..40a3f91b 100644
--- a/lib/maps-file-data-source.c
+++ b/lib/maps-file-data-source.c
@@ -470,15 +470,14 @@ on_file_load (GObject      *source_object,
   FillTileData *data = g_task_get_task_data (task);
   char *contents;
   gsize length;
-  GBytes *bytes;
 
   g_file_load_contents_finish (data->file, res, &contents, &length, NULL, NULL);
 
   if (contents != NULL)
     {
-      bytes = g_bytes_new_take (contents, length);
+      data->bytes = g_bytes_new_take (contents, length);
       g_signal_emit_by_name (data->self, "received-data", data->x, data->y, data->z, data->bytes);
-      g_task_return_pointer (task, g_steal_pointer (&bytes), (GDestroyNotify)g_bytes_unref);
+      g_task_return_pointer (task, g_steal_pointer (&data->bytes), (GDestroyNotify)g_bytes_unref);
     }
 }
 


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