diff options
Diffstat (limited to 'src/mbgl/map/vector_tile_data.cpp')
-rw-r--r-- | src/mbgl/map/vector_tile_data.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/mbgl/map/vector_tile_data.cpp b/src/mbgl/map/vector_tile_data.cpp index 06782057f6..646ad7318a 100644 --- a/src/mbgl/map/vector_tile_data.cpp +++ b/src/mbgl/map/vector_tile_data.cpp @@ -5,6 +5,7 @@ #include <mbgl/style/style_layer.hpp> #include <mbgl/style/style_bucket.hpp> #include <mbgl/geometry/glyph_atlas.hpp> +#include <mbgl/platform/log.hpp> using namespace mbgl; @@ -13,8 +14,8 @@ VectorTileData::VectorTileData(Tile::ID const& id_, GlyphAtlas& glyphAtlas_, GlyphStore& glyphStore_, SpriteAtlas& spriteAtlas_, util::ptr<Sprite> sprite_, TexturePool& texturePool_, - const SourceInfo& source_) - : TileData(id_, source_), + const SourceInfo& source_, FileSource &fileSource_) + : TileData(id_, source_, fileSource_), glyphAtlas(glyphAtlas_), glyphStore(glyphStore_), spriteAtlas(spriteAtlas_), @@ -35,6 +36,10 @@ void VectorTileData::parse() { } try { + if (!style) { + throw std::runtime_error("style isn't present in VectorTileData object anymore"); + } + // Parsing creates state that is encapsulated in TileParser. While parsing, // the TileParser object writes results into this objects. All other state // is going to be discarded afterwards. @@ -42,12 +47,13 @@ void VectorTileData::parse() { glyphAtlas, glyphStore, spriteAtlas, sprite, texturePool); + // Clear the style so that we don't have a cycle in the shared_ptr references. + style.reset(); + parser.parse(); } catch (const std::exception& ex) { -#if defined(DEBUG) - fprintf(stderr, "[%p] exception [%d/%d/%d]... failed: %s\n", this, id.z, id.x, id.y, ex.what()); -#endif - cancel(); + Log::Error(Event::ParseTile, "Parsing [%d/%d/%d] failed: %s", id.z, id.x, id.y, ex.what()); + state = State::obsolete; return; } |