diff options
author | Jiří Techet <techet@gmail.com> | 2013-08-21 14:10:50 +0200 |
---|---|---|
committer | Jiří Techet <techet@gmail.com> | 2013-08-21 14:10:50 +0200 |
commit | 2834b443382878a7e8c9f47a096915c95aacceb8 (patch) | |
tree | 207c3f4da33022fd5354a32245f2b19957ef9928 | |
parent | 3adb78f718e63aeb3ca5c15b59c1469f8cbc9e12 (diff) | |
download | libchamplain-2834b443382878a7e8c9f47a096915c95aacceb8.tar.gz |
Add a check for a correct map source in tile loading idle function
Map source can be changed before the idle is executed so we should check
whether to load the given tile or not.
-rw-r--r-- | champlain/champlain-view.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c index 75b90a1..eed2c47 100644 --- a/champlain/champlain-view.c +++ b/champlain/champlain-view.c @@ -133,6 +133,7 @@ typedef struct typedef struct { ChamplainView *view; + ChamplainMapSource *map_source; gint x; gint y; gint zoom_level; @@ -1946,7 +1947,7 @@ fill_tile_cb (FillTileCallbackData *data) gint size = data->size; gint zoom_level = data->zoom_level; - if (!tile_in_tile_map (view, x, y) && zoom_level == priv->zoom_level && + if (!tile_in_tile_map (view, x, y) && zoom_level == priv->zoom_level && data->map_source == priv->map_source && y >= priv->tile_y_first && y < priv->tile_y_last && x >= priv->tile_x_first && x < priv->tile_x_last) { GList *iter; @@ -2049,6 +2050,9 @@ load_visible_tiles (ChamplainView *view, data->y = y; data->size = size; data->zoom_level = priv->zoom_level; + /* used only to check that the map source didn't change before the + * idle function is called */ + data->map_source = priv->map_source; data->view = g_object_ref (view); g_idle_add_full (CLUTTER_PRIORITY_REDRAW, (GSourceFunc) fill_tile_cb, data, NULL); |