-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Clear out GeometryTileWorker::layers during redoLayout #7648
Conversation
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.
@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; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
Alternate fix added to #7616. |
Merged alternate fix. |
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()
. ThesetData()
call doesn't immediately process the tiles, since it will still be lacking layer data.