Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[not ready] fixes #1267: properly break reference cycle with tile data & style #1280

Merged
merged 2 commits into from
Apr 16, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions src/mbgl/map/live_tile_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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) {
Expand Down