Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Avoid calling AnnotationManager::updateStyle until the style i…
Browse files Browse the repository at this point in the history
…s loaded

Fixes #3037
  • Loading branch information
jfirebaugh authored and incanus committed Nov 19, 2015
1 parent fcec19b commit db1c4f2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mbgl/map/map_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions src/mbgl/style/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/mbgl/style/style.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class Style : public GlyphStore::Observer,
void emitTileDataChanged();
void emitResourceLoadingFailed(std::exception_ptr error);

bool loaded = false;
bool shouldReparsePartialTiles = false;

Observer* observer = nullptr;
Expand Down

0 comments on commit db1c4f2

Please sign in to comment.