[libshumate] file-cache: Propagate GCancellable
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libshumate] file-cache: Propagate GCancellable
- Date: Sun, 14 Feb 2021 11:58:59 +0000 (UTC)
commit 83759edcce80c165bb065007ed34c63246613419
Author: James Westman <james jwestman net>
Date: Fri Feb 12 23:33:18 2021 -0600
file-cache: Propagate GCancellable
Properly pass the GCancellable through the various async functions that
are called when loading a tile. This prevents a race condition that
occurred when the tile grid was being filled.
Fixes #6.
shumate/shumate-file-cache.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/shumate/shumate-file-cache.c b/shumate/shumate-file-cache.c
index ceb5f65..a74b4b1 100644
--- a/shumate/shumate-file-cache.c
+++ b/shumate/shumate-file-cache.c
@@ -519,7 +519,7 @@ on_pixbuf_created (GObject *source_object,
/* Retrieve modification time */
info = g_file_query_info (file,
G_FILE_ATTRIBUTE_TIME_MODIFIED,
- G_FILE_QUERY_INFO_NONE, NULL, NULL);
+ G_FILE_QUERY_INFO_NONE, loaded_data->cancellable, NULL);
if (info)
{
g_autoptr(GDateTime) modified_time = g_file_info_get_modification_date_time (info);
@@ -595,6 +595,7 @@ on_file_loaded (GObject *source_object,
ShumateTile *tile = loaded_data->tile;
g_autoptr(GError) error = NULL;
g_autoptr(GInputStream) input_stream = NULL;
+ GCancellable *cancellable = loaded_data->cancellable;
input_stream = G_INPUT_STREAM (g_file_read_finish (G_FILE (source_object), res, &error));
if (!input_stream)
@@ -610,7 +611,7 @@ on_file_loaded (GObject *source_object,
return;
}
- gdk_pixbuf_new_from_stream_async (input_stream, NULL, on_pixbuf_created, g_steal_pointer (&loaded_data));
+ gdk_pixbuf_new_from_stream_async (input_stream, cancellable, on_pixbuf_created, g_steal_pointer
(&loaded_data));
}
@@ -646,7 +647,7 @@ fill_tile (ShumateMapSource *map_source,
DEBUG ("fill of %s", filename);
- g_file_read_async (file, G_PRIORITY_DEFAULT, NULL, on_file_loaded, user_data);
+ g_file_read_async (file, G_PRIORITY_DEFAULT, cancellable, on_file_loaded, user_data);
}
else if (SHUMATE_IS_MAP_SOURCE (next_source))
shumate_map_source_fill_tile (next_source, tile, cancellable);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]