summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-01-07 12:05:51 +0100
committerKonstantin Käfer <mail@kkaefer.com>2016-01-15 12:48:23 +0100
commit180b3f125f191d1912d152d1064228013f39552f (patch)
tree47836d7c55a088f3bf54c733911efb8b109d8465 /src
parent5fe586633cb15c99f77ca478446679acf42fddd1 (diff)
downloadqtlocation-mapboxgl-180b3f125f191d1912d152d1064228013f39552f.tar.gz
[core] don't mark tiles with failed requests as obsolete
Otherwise, this will remove them from the map and overwrite the old data. This could happen e.g. when we have connection trouble and a tile needs to be refreshed, or we're displaying stale information and the connection is down.
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/map/source.cpp2
-rw-r--r--src/mbgl/map/tile_data.hpp4
-rw-r--r--src/mbgl/map/vector_tile_data.cpp6
3 files changed, 10 insertions, 2 deletions
diff --git a/src/mbgl/map/source.cpp b/src/mbgl/map/source.cpp
index 4432b3a490..613972e930 100644
--- a/src/mbgl/map/source.cpp
+++ b/src/mbgl/map/source.cpp
@@ -531,7 +531,7 @@ void Source::tileLoadingCompleteCallback(const TileID& tileID, const TransformSt
return;
}
- if (tileData->getState() == TileData::State::obsolete && tileData->getError()) {
+ if (tileData->hasError()) {
observer->onTileError(*this, tileID, tileData->getError());
return;
}
diff --git a/src/mbgl/map/tile_data.hpp b/src/mbgl/map/tile_data.hpp
index 2bb11054a6..e31cced964 100644
--- a/src/mbgl/map/tile_data.hpp
+++ b/src/mbgl/map/tile_data.hpp
@@ -88,6 +88,10 @@ public:
return state;
}
+ bool hasError() const {
+ return error.operator bool();
+ }
+
std::exception_ptr getError() const {
return error;
}
diff --git a/src/mbgl/map/vector_tile_data.cpp b/src/mbgl/map/vector_tile_data.cpp
index f44dc75982..ee43373a69 100644
--- a/src/mbgl/map/vector_tile_data.cpp
+++ b/src/mbgl/map/vector_tile_data.cpp
@@ -33,12 +33,16 @@ VectorTileData::VectorTileData(const TileID& id_,
Seconds expires_) {
if (err) {
error = err;
- state = State::obsolete;
callback();
return;
}
+ // Reset the error if we didn't receive one for this request. This is to prevent old error
+ // messages from being displayed again, e.g. after a connection trouble cleared up.
+ error = nullptr;
+
if (!tile) {
+ // This is a 404 response. We're treating these as empty tiles.
state = State::parsed;
buckets.clear();
callback();