Merge pull request #1280 from mapbox/source-release-fix

[not ready] fixes #1267: properly break reference cycle with tile data & style
This commit is contained in:
Justin R. Miller
2015-04-16 00:33:33 -07:00

View File

@@ -31,13 +31,14 @@ void LiveTileData::parse() {
return;
}
try {
if (!style) {
throw std::runtime_error("style isn't present in LiveTileData object anymore");
}
const LiveTile* tile = annotationManager.getTile(id);
if (tile) {
try {
if (!style) {
throw std::runtime_error("style isn't present in LiveTileData object anymore");
}
const LiveTile* tile = annotationManager.getTile(id);
if (tile) {
// 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.
@@ -47,13 +48,16 @@ void LiveTileData::parse() {
style.reset();
parser.parse();
} else {
} 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;
}
} catch (const std::exception& ex) {
Log::Error(Event::ParseTile, "Live-parsing [%d/%d/%d] failed: %s", id.z, id.x, id.y, ex.what());
} else {
// Clear the style so that we don't have a cycle in the shared_ptr references.
style.reset();
state = State::obsolete;
return;
}
if (state != State::obsolete) {