[core] normalize TileData::State::obsolete handling

This commit is contained in:
Konstantin Käfer
2016-05-25 20:10:57 +02:00
parent c52a0c65f4
commit c91e4ee1f4
2 changed files with 5 additions and 12 deletions

View File

@@ -62,9 +62,6 @@ VectorTileData::VectorTileData(const OverscaledTileID& id_,
workRequest.reset();
workRequest = worker.parseGeometryTile(tileWorker, style.getLayers(), std::move(tile), targetConfig, [callback, this, config = targetConfig] (TileParseResult result) {
workRequest.reset();
if (state == State::obsolete) {
return;
}
std::exception_ptr error;
if (result.is<TileParseResultData>()) {
@@ -85,8 +82,9 @@ VectorTileData::VectorTileData(const OverscaledTileID& id_,
}
} else {
// This is triggered when parsing fails (e.g. due to an invalid vector tile)
error = result.get<std::exception_ptr>();
state = State::obsolete;
state = State::parsed;
}
callback(error);
@@ -107,9 +105,6 @@ bool VectorTileData::parsePending(std::function<void(std::exception_ptr)> callba
workRequest.reset();
workRequest = worker.parsePendingGeometryTileLayers(tileWorker, targetConfig, [this, callback, config = targetConfig] (TileParseResult result) {
workRequest.reset();
if (state == State::obsolete) {
return;
}
std::exception_ptr error;
if (result.is<TileParseResultData>()) {
@@ -133,7 +128,7 @@ bool VectorTileData::parsePending(std::function<void(std::exception_ptr)> callba
} else {
error = result.get<std::exception_ptr>();
state = State::obsolete;
state = State::parsed;
}
callback(error);