summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-11-18 13:21:16 -0800
committerJustin R. Miller <incanus@codesorcery.net>2015-11-18 16:05:13 -0800
commitdb1c4f2cc2f57b5ea790cac09bd9923b5d86a0ce (patch)
tree95d8111eb63460696280094d53f78f16906b23f4 /src
parentfcec19b8357e65d39d429a175001ef4fc1876686 (diff)
downloadqtlocation-mapboxgl-db1c4f2cc2f57b5ea790cac09bd9923b5d86a0ce.tar.gz
[core] Avoid calling AnnotationManager::updateStyle until the style is loaded
Fixes #3037
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/map/map_context.cpp2
-rw-r--r--src/mbgl/style/style.cpp6
-rw-r--r--src/mbgl/style/style.hpp1
3 files changed, 8 insertions, 1 deletions
diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp
index 6fbd35ad78..3db1138dfd 100644
--- a/src/mbgl/map/map_context.cpp
+++ b/src/mbgl/map/map_context.cpp
@@ -169,7 +169,7 @@ void MapContext::update() {
data.setAnimationTime(Clock::now());
- if (updateFlags & Update::Annotations) {
+ if (style->isLoaded() && updateFlags & Update::Annotations) {
data.getAnnotationManager()->updateStyle(*style);
updateFlags |= Update::Classes;
}
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index 14d93fb12a..3523a72079 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -57,6 +57,8 @@ void Style::setJSON(const std::string& json, const std::string&) {
glyphStore->setURL(parser.getGlyphURL());
spriteStore->setURL(parser.getSpriteURL());
+
+ loaded = true;
}
Style::~Style() {
@@ -175,6 +177,10 @@ bool Style::hasTransitions() const {
}
bool Style::isLoaded() const {
+ if (!loaded) {
+ return false;
+ }
+
for (const auto& source : sources) {
if (!source->isLoaded()) {
return false;
diff --git a/src/mbgl/style/style.hpp b/src/mbgl/style/style.hpp
index 5f18a8fec4..4eef6cce75 100644
--- a/src/mbgl/style/style.hpp
+++ b/src/mbgl/style/style.hpp
@@ -100,6 +100,7 @@ private:
void emitTileDataChanged();
void emitResourceLoadingFailed(std::exception_ptr error);
+ bool loaded = false;
bool shouldReparsePartialTiles = false;
Observer* observer = nullptr;