fixes #1267: properly break reference cycle with live tile data & style

This commit is contained in:
Justin R. Miller
2015-04-15 22:16:18 -07:00
parent 109a693f00
commit d29534e437

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,14 @@ 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 {
style.reset();
state = State::obsolete;
return;
}
if (state != State::obsolete) {