summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnsis Brammanis <brammanis@gmail.com>2015-06-02 17:06:24 -0400
committerAnsis Brammanis <brammanis@gmail.com>2015-06-02 17:06:24 -0400
commit1f5fb1db4afae8a8bae02c42870f6f9e5e5f7905 (patch)
tree44cdb88ee395d076e43aae07c7200055d90833f4 /src
parent3dfa317cf9689c5bbd0994f86bdf6b068b1c6716 (diff)
downloadqtlocation-mapboxgl-1f5fb1db4afae8a8bae02c42870f6f9e5e5f7905.tar.gz
fix hangs caused by redoPlacement
After parsing a tile, it redoes placement for that tile if the angle has changed since it started parsing. These redo calls were accidentally done from the worker thread. Assigning the new work to `workRequest` caused it to cancel itself. Fix the problem by calling redoPlacement from the map thread.
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/map/live_tile_data.cpp1
-rw-r--r--src/mbgl/map/source.cpp16
-rw-r--r--src/mbgl/map/source.hpp3
-rw-r--r--src/mbgl/map/vector_tile_data.cpp1
4 files changed, 8 insertions, 13 deletions
diff --git a/src/mbgl/map/live_tile_data.cpp b/src/mbgl/map/live_tile_data.cpp
index f2b5e0427d..1d8c42e1e4 100644
--- a/src/mbgl/map/live_tile_data.cpp
+++ b/src/mbgl/map/live_tile_data.cpp
@@ -55,6 +55,5 @@ void LiveTileData::parse() {
if (getState() != State::obsolete) {
setState(State::parsed);
- redoPlacement();
}
}
diff --git a/src/mbgl/map/source.cpp b/src/mbgl/map/source.cpp
index b6838a4713..ae39b84ee3 100644
--- a/src/mbgl/map/source.cpp
+++ b/src/mbgl/map/source.cpp
@@ -290,7 +290,7 @@ TileData::State Source::addTile(MapData& data,
}
if (!new_tile.data) {
- auto callback = std::bind(&Source::tileLoadingCompleteCallback, this, normalized_id);
+ auto callback = std::bind(&Source::tileLoadingCompleteCallback, this, normalized_id, transformState, data.getCollisionDebug());
// If we don't find working tile data, we're just going to load it.
if (info.type == SourceType::Vector) {
@@ -513,7 +513,9 @@ bool Source::update(MapData& data,
updateTilePtrs();
- redoPlacement(transformState, data.getCollisionDebug());
+ for (auto& tilePtr : tilePtrs) {
+ tilePtr->data->redoPlacement(transformState.getAngle(), data.getCollisionDebug());
+ }
updated = data.getAnimationTime();
@@ -536,12 +538,6 @@ void Source::updateTilePtrs() {
}
}
-void Source::redoPlacement(const TransformState& transformState, bool collisionDebug) {
- for (auto& tilePtr : tilePtrs) {
- tilePtr->data->redoPlacement(transformState.getAngle(), collisionDebug);
- }
-}
-
void Source::setCacheSize(size_t size) {
cache.setSize(size);
}
@@ -554,7 +550,7 @@ void Source::setObserver(Observer* observer) {
observer_ = observer;
}
-void Source::tileLoadingCompleteCallback(const TileID& normalized_id) {
+void Source::tileLoadingCompleteCallback(const TileID& normalized_id, const TransformState& transformState, bool collisionDebug) {
auto it = tile_data.find(normalized_id);
if (it == tile_data.end()) {
return;
@@ -571,6 +567,8 @@ void Source::tileLoadingCompleteCallback(const TileID& normalized_id) {
}
emitTileLoaded(true);
+ data->redoPlacement(transformState.getAngle(), collisionDebug);
+
}
void Source::emitSourceLoaded() {
diff --git a/src/mbgl/map/source.hpp b/src/mbgl/map/source.hpp
index bf49bd69ea..be869559b5 100644
--- a/src/mbgl/map/source.hpp
+++ b/src/mbgl/map/source.hpp
@@ -104,8 +104,7 @@ public:
bool enabled;
private:
- void redoPlacement(const TransformState& transformState, bool collisionDebug);
- void tileLoadingCompleteCallback(const TileID& normalized_id);
+ void tileLoadingCompleteCallback(const TileID& normalized_id, const TransformState& transformState, bool collisionDebug);
void emitSourceLoaded();
void emitSourceLoadingFailed(const std::string& message);
diff --git a/src/mbgl/map/vector_tile_data.cpp b/src/mbgl/map/vector_tile_data.cpp
index 799eeb80c8..d431a200e6 100644
--- a/src/mbgl/map/vector_tile_data.cpp
+++ b/src/mbgl/map/vector_tile_data.cpp
@@ -64,7 +64,6 @@ void VectorTileData::parse() {
setState(State::partial);
} else {
setState(State::parsed);
- redoPlacement();
}
} catch (const std::exception& ex) {
std::stringstream message;