diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-01-14 20:59:17 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2016-01-15 17:04:08 +0100 |
commit | 32a2359e86bc86221682f1afa057b62f0f0be8c2 (patch) | |
tree | 3e566b6ad9417224af567b3de5d0670654dd9787 /src/mbgl/map/raster_tile_data.cpp | |
parent | bd1f71cdbd4aa55ffa1beb61ddee1dd6da32412d (diff) | |
download | qtlocation-mapboxgl-32a2359e86bc86221682f1afa057b62f0f0be8c2.tar.gz |
[core] don't store error state
Previously, we could first get a stale response from cache, then immediately a "connection error" response that overwrote the error state variable. In the tileLoadingCompleteCallback, we'd only see the second overwritten error state and abort. This could lead to the map sometimes not being rendered at all until the user interacts with the map.
Diffstat (limited to 'src/mbgl/map/raster_tile_data.cpp')
-rw-r--r-- | src/mbgl/map/raster_tile_data.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mbgl/map/raster_tile_data.cpp b/src/mbgl/map/raster_tile_data.cpp index da2dd808bd..92ffb451b0 100644 --- a/src/mbgl/map/raster_tile_data.cpp +++ b/src/mbgl/map/raster_tile_data.cpp @@ -27,6 +27,7 @@ void RasterTileData::request(const std::string& url, FileSource* fs = util::ThreadContext::getFileSource(); req = fs->request({ Resource::Kind::Tile, url }, [url, callback, this](Response res) { if (res.error) { + std::exception_ptr error; if (res.error->reason == Response::Error::Reason::NotFound) { // This is a 404 response. We're treating these as empty tiles. workRequest.reset(); @@ -36,7 +37,7 @@ void RasterTileData::request(const std::string& url, // This is a different error, e.g. a connection or server error. error = std::make_exception_ptr(std::runtime_error(res.error->message)); } - callback(); + callback(error); return; } @@ -60,6 +61,7 @@ void RasterTileData::request(const std::string& url, return; } + std::exception_ptr error; if (result.is<std::unique_ptr<Bucket>>()) { state = State::parsed; bucket = std::move(result.get<std::unique_ptr<Bucket>>()); @@ -69,7 +71,7 @@ void RasterTileData::request(const std::string& url, bucket.reset(); } - callback(); + callback(error); }); }); } |