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

Clear out GeometryTileWorker::layers during redoLayout #7648

Closed
wants to merge 3 commits into from

Conversation

kkaefer
Copy link
Contributor

@kkaefer kkaefer commented Jan 9, 2017

This avoids a corner case where redoLayout was called with a new set of data, but the layer objects were moved out during the previous call to redoLayout. When setting new data, we call setData() first, then setLayout(). The setData() call doesn't immediately process the tiles, since it will still be lacking layer data.

jfirebaugh and others added 3 commits January 6, 2017 13:52
Discard prior symbol buckets only when new symbol buckets became available, in order to eliminate flickering when tiles are refreshed.
This reduces state and simplifies the test added in the prior commit.
This avoids a corner case where redoLayout was called with a new set of data, but the layer objects were moved out during the previous call to redoLayout. When setting new data, we call setData() first, then setLayout(). The setData() call doesn't immediately process the tiles, since it will still be lacking layer data.
@mention-bot
Copy link

@kkaefer, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh to be potential reviewers.

@@ -215,6 +215,8 @@ void GeometryTileWorker::redoLayout() {
BucketParameters parameters { id, obsolete, *featureIndex, mode };

std::vector<std::vector<std::unique_ptr<Layer>>> groups = groupByLayout(std::move(*layers));
layers = nullopt;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reset the optional

@@ -280,7 +282,7 @@ bool GeometryTileWorker::hasPendingSymbolDependencies() const {
}

void GeometryTileWorker::attemptPlacement() {
if (!data || !layers || !placementConfig) {
if (!placementConfig) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need access to data and layers anymore, since all of that is encoded in the SymbolLayout objects now. This change is necessary, since disengaging the optional will make this check fail when it is part of redoLayout() (called at the very end), meaning that there won't be any symbols until placement is triggered again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a feeling at least one of these guards was needed to ensure that the body of attemptPlacement does not run if setPlacementConfig is called before setData and setLayers.

@jfirebaugh
Copy link
Contributor

Alternate fix added to #7616.

@jfirebaugh
Copy link
Contributor

Merged alternate fix.

@jfirebaugh jfirebaugh closed this Jan 10, 2017
@kkaefer kkaefer deleted the 7615-reset-layers-after-redolayout branch April 24, 2017 08:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants