summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnsis Brammanis <brammanis@gmail.com>2016-01-28 11:26:39 -0800
committerAnsis Brammanis <brammanis@gmail.com>2016-01-29 10:35:40 -0800
commit0439d003135dbdd15a993efff712e27cd15ab89e (patch)
tree4fba52ea63766ebc258ea7ccfdfd850a863bb6c8 /src
parent1bdd0762d074fe6fac1cc5f7704eefdfcddacadb (diff)
downloadqtlocation-mapboxgl-0439d003135dbdd15a993efff712e27cd15ab89e.tar.gz
[core] fix redoPlacement blocking main thread, fix #3727
If a workRequest exists, don't cancel it and start an new request. It's ok to just do nothing if the request exists because a new call to redoPlacement will be triggered after the existing request finishes. this fixes a regression in e44db93f1cb3276dcdc7de8400ca96beda1b1d30
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/map/vector_tile_data.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/mbgl/map/vector_tile_data.cpp b/src/mbgl/map/vector_tile_data.cpp
index df7923273c..27172a3e63 100644
--- a/src/mbgl/map/vector_tile_data.cpp
+++ b/src/mbgl/map/vector_tile_data.cpp
@@ -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();