Change StyleBucket::source to indirect reference

This eliminates a reference loop: VectorTileData holds StyleLayers which
hold StyleBuckets which held Sources which hold VectorTileDatas. This
breaks the StyleBucket -> Source link in favor of manually resolving the
reference where necessary.
This commit is contained in:
John Firebaugh
2015-06-17 14:08:40 -07:00
parent 0581df8787
commit fd58861fcd
6 changed files with 31 additions and 22 deletions

View File

@@ -323,7 +323,8 @@ std::vector<RenderItem> Painter::determineRenderOrder(const Style& style) {
continue;
}
if (!layer.bucket->source) {
util::ptr<Source> source = style.getSource(layer.bucket->source);
if (!source) {
Log::Warning(Event::Render, "can't find source for layer '%s'", layer.id.c_str());
continue;
}
@@ -345,7 +346,7 @@ std::vector<RenderItem> Painter::determineRenderOrder(const Style& style) {
// Determine what render passes we need for this layer.
const RenderPass passes = determineRenderPasses(layer);
const auto& tiles = layer.bucket->source->getTiles();
const auto& tiles = source->getTiles();
for (auto tile : tiles) {
assert(tile);
if (!tile->data && !tile->data->isReady()) {