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.
Marcus Lundblad
1 year, 7 months ago
469 | 469 | FillTileData *data = g_task_get_task_data (task); |
470 | 470 | char *contents; |
471 | 471 | gsize length; |
472 | GBytes *bytes; | |
473 | 472 | |
474 | 473 | g_file_load_contents_finish (data->file, res, &contents, &length, NULL, NULL); |
475 | 474 | |
476 | 475 | if (contents != NULL) |
477 | 476 | { |
478 | bytes = g_bytes_new_take (contents, length); | |
477 | data->bytes = g_bytes_new_take (contents, length); | |
479 | 478 | g_signal_emit_by_name (data->self, "received-data", data->x, data->y, data->z, data->bytes); |
480 | g_task_return_pointer (task, g_steal_pointer (&bytes), (GDestroyNotify)g_bytes_unref); | |
479 | g_task_return_pointer (task, g_steal_pointer (&data->bytes), (GDestroyNotify)g_bytes_unref); | |
481 | 480 | } |
482 | 481 | } |
483 | 482 |