[core] Avoid calling AnnotationManager::updateStyle until the style is loaded
Fixes #3037
This commit is contained in:
committed by
Justin R. Miller
parent
fcec19b835
commit
db1c4f2cc2
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -100,6 +100,7 @@ private:
|
||||
void emitTileDataChanged();
|
||||
void emitResourceLoadingFailed(std::exception_ptr error);
|
||||
|
||||
bool loaded = false;
|
||||
bool shouldReparsePartialTiles = false;
|
||||
|
||||
Observer* observer = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user