[core] Synchronize state of CollisionIndex and FeatureIndexes.

Fixes issue #10778, in which mismatch between FeatureIndex and CollisionIndex could lead to inconsistent results or even invalid array access.
This commit is contained in:
Chris Loer
2018-01-17 14:26:36 -08:00
committed by Chris Loer
parent 42845ad63f
commit 656a6373b9
5 changed files with 29 additions and 1 deletions

View File

@@ -389,6 +389,10 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
}
placementChanged = newPlacement->commit(*placement, parameters.timePoint);
// commitFeatureIndexes depends on the assumption that no new FeatureIndex has been loaded since placement
// started. If we violate this assumption, then we need to either make CollisionIndex completely independendent of
// FeatureIndex, or find a way for its entries to point to multiple FeatureIndexes.
commitFeatureIndexes();
if (placementChanged || symbolBucketsChanged) {
placement = std::move(newPlacement);
}
@@ -768,6 +772,15 @@ bool Renderer::Impl::hasTransitions(TimePoint timePoint) const {
return false;
}
void Renderer::Impl::commitFeatureIndexes() {
for (auto& source : renderSources) {
for (auto& renderTile : source.second->getRenderTiles()) {
Tile& tile = renderTile.get().tile;
tile.commitFeatureIndex();
}
}
}
void Renderer::Impl::updateFadingTiles() {
fadingTiles = false;
for (auto& source : renderSources) {