Convert Style to unique_ptr and pass by reference
Fixes #1277 Fixes #1309
This commit is contained in:
@@ -11,7 +11,7 @@ using namespace mbgl;
|
||||
LiveTileData::LiveTileData(const TileID& id_,
|
||||
AnnotationManager& annotationManager_,
|
||||
float mapMaxZoom,
|
||||
util::ptr<Style> style_,
|
||||
Style& style_,
|
||||
GlyphAtlas& glyphAtlas_,
|
||||
GlyphStore& glyphStore_,
|
||||
SpriteAtlas& spriteAtlas_,
|
||||
@@ -35,27 +35,16 @@ void LiveTileData::parse() {
|
||||
|
||||
if (tile) {
|
||||
try {
|
||||
if (!style) {
|
||||
throw std::runtime_error("style isn't present in LiveTileData 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.
|
||||
TileParser parser(*tile, *this, style, glyphAtlas, glyphStore, spriteAtlas, sprite);
|
||||
|
||||
// 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) {
|
||||
Log::Error(Event::ParseTile, "Live-parsing [%d/%d/%d] failed: %s", id.z, id.x, id.y, ex.what());
|
||||
state = State::obsolete;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Clear the style so that we don't have a cycle in the shared_ptr references.
|
||||
style.reset();
|
||||
}
|
||||
|
||||
if (state != State::obsolete) {
|
||||
|
||||
Reference in New Issue
Block a user