summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2020-02-13 11:56:13 +0200
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2020-02-14 11:54:02 +0200
commit89eab0530df08baf292d6d1260a3ae43019e3541 (patch)
tree29b0d82ca7ee3a68e275c3a3438ada2dbae48956 /src
parent06f7951490982d777aae9f8144bfb8dcb508d234 (diff)
downloadqtlocation-mapboxgl-89eab0530df08baf292d6d1260a3ae43019e3541.tar.gz
[core] Set priorData from cache only if resource is useable
In cases when cached resource is useable, yet don't have an expiration timestamp, we provided data to the requester from the cache and the same data was returned once 304 response was received from the network.
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/sprite/sprite_loader.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mbgl/sprite/sprite_loader.cpp b/src/mbgl/sprite/sprite_loader.cpp
index 56f7abd50b..60bab2bf6e 100644
--- a/src/mbgl/sprite/sprite_loader.cpp
+++ b/src/mbgl/sprite/sprite_loader.cpp
@@ -60,7 +60,8 @@ void SpriteLoader::load(const std::string& url, FileSource& fileSource) {
emitSpriteLoadedIfComplete();
} else {
// Only trigger a sprite loaded event we got new data.
- loader->json = res.data;
+ assert(loader->json != res.data);
+ loader->json = std::move(res.data);
emitSpriteLoadedIfComplete();
}
});
@@ -74,7 +75,8 @@ void SpriteLoader::load(const std::string& url, FileSource& fileSource) {
loader->image = std::make_shared<std::string>();
emitSpriteLoadedIfComplete();
} else {
- loader->image = res.data;
+ assert(loader->image != res.data);
+ loader->image = std::move(res.data);
emitSpriteLoadedIfComplete();
}
});