summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-10-19 09:01:41 -0700
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-10-19 09:01:41 -0700
commitac7b40dc9a14e48ef041b9f2e47f0b563abe64cc (patch)
tree2a57dd02bfe54d7a33a2a8480cc80aaf7fe648ec
parent945e53af4ef5c6473080ef7efe2d885aefeac3ab (diff)
downloadqtlocation-mapboxgl-ac7b40dc9a14e48ef041b9f2e47f0b563abe64cc.tar.gz
[node] Reuse HeadlessFrontend if any in NodeMap::cancel()
-rw-r--r--platform/node/src/node_map.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp
index f344461f31..198e9301f8 100644
--- a/platform/node/src/node_map.cpp
+++ b/platform/node/src/node_map.cpp
@@ -538,7 +538,10 @@ void NodeMap::cancel() {
// Reset map explicitly as it resets the renderer frontend
map.reset();
- frontend = std::make_unique<mbgl::HeadlessFrontend>(mbgl::Size{ 256, 256 }, pixelRatio, *this, threadpool);
+ if (!frontend) {
+ frontend = std::make_unique<mbgl::HeadlessFrontend>(mbgl::Size{ 256, 256 }, pixelRatio, *this, threadpool);
+ }
+
map = std::make_unique<mbgl::Map>(*frontend, mapObserver, frontend->getSize(), pixelRatio,
*this, threadpool, mbgl::MapMode::Still);