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

fix redoPlacement blocking main thread, fix #3727 #3731

Merged
merged 1 commit into from
Jan 29, 2016
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
11 changes: 5 additions & 6 deletions src/mbgl/map/vector_tile_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,15 @@ void VectorTileData::redoPlacement(const PlacementConfig newConfig, const std::f
if (newConfig != placedConfig) {
targetConfig = newConfig;

if (!workRequest) {
// Don't start a new placement request when the current one hasn't completed yet, or when
// we are parsing buckets.
redoPlacement(callback);
}
redoPlacement(callback);
}
}

void VectorTileData::redoPlacement(const std::function<void()>& callback) {
workRequest.reset();
// Don't start a new placement request when the current one hasn't completed yet, or when
// we are parsing buckets.
if (workRequest) return;

workRequest = worker.redoPlacement(tileWorker, buckets, targetConfig, [this, callback, config = targetConfig] {
workRequest.reset();

Expand Down