summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mbgl/util/run_loop.hpp2
-rw-r--r--src/mbgl/map/tile_worker.cpp4
-rw-r--r--src/mbgl/map/tile_worker.hpp2
-rw-r--r--src/mbgl/util/worker.cpp6
4 files changed, 8 insertions, 6 deletions
diff --git a/include/mbgl/util/run_loop.hpp b/include/mbgl/util/run_loop.hpp
index e3d9248f84..6075d76c8c 100644
--- a/include/mbgl/util/run_loop.hpp
+++ b/include/mbgl/util/run_loop.hpp
@@ -146,7 +146,7 @@ private:
private:
template <std::size_t... I>
void invoke(std::index_sequence<I...>) {
- func(std::get<I>(std::forward<P>(params))...);
+ func(std::move(std::get<I>(std::forward<P>(params)))...);
}
std::recursive_mutex mutex;
diff --git a/src/mbgl/map/tile_worker.cpp b/src/mbgl/map/tile_worker.cpp
index a7f733eed9..edbd392057 100644
--- a/src/mbgl/map/tile_worker.cpp
+++ b/src/mbgl/map/tile_worker.cpp
@@ -37,7 +37,7 @@ TileWorker::~TileWorker() {
}
TileParseResult TileWorker::parseAllLayers(std::vector<std::unique_ptr<StyleLayer>> layers_,
- const GeometryTile& geometryTile,
+ std::unique_ptr<const GeometryTile> geometryTile,
PlacementConfig config) {
// We're doing a fresh parse of the tile, because the underlying data has changed.
pending.clear();
@@ -55,7 +55,7 @@ TileParseResult TileWorker::parseAllLayers(std::vector<std::unique_ptr<StyleLaye
const StyleLayer* layer = i->get();
if (parsed.find(layer->bucketName()) == parsed.end()) {
parsed.emplace(layer->bucketName());
- parseLayer(layer, geometryTile);
+ parseLayer(layer, *geometryTile);
}
}
diff --git a/src/mbgl/map/tile_worker.hpp b/src/mbgl/map/tile_worker.hpp
index a5e892e2b6..bcd8e59bf9 100644
--- a/src/mbgl/map/tile_worker.hpp
+++ b/src/mbgl/map/tile_worker.hpp
@@ -50,7 +50,7 @@ public:
~TileWorker();
TileParseResult parseAllLayers(std::vector<std::unique_ptr<StyleLayer>>,
- const GeometryTile&,
+ std::unique_ptr<const GeometryTile> geometryTile,
PlacementConfig);
TileParseResult parsePendingLayers(PlacementConfig);
diff --git a/src/mbgl/util/worker.cpp b/src/mbgl/util/worker.cpp
index d1e54fa375..fe8ee81779 100644
--- a/src/mbgl/util/worker.cpp
+++ b/src/mbgl/util/worker.cpp
@@ -16,10 +16,12 @@ public:
Impl() = default;
void parseRasterTile(std::unique_ptr<RasterBucket> bucket,
- const std::shared_ptr<const std::string> data,
+ std::shared_ptr<const std::string> data,
std::function<void(RasterTileParseResult)> callback) {
try {
bucket->setImage(decodeImage(*data));
+ // Destruct the shared pointer before calling the callback.
+ data.reset();
callback(RasterTileParseResult(std::move(bucket)));
} catch (...) {
callback(std::current_exception());
@@ -32,7 +34,7 @@ public:
PlacementConfig config,
std::function<void(TileParseResult)> callback) {
try {
- callback(worker->parseAllLayers(std::move(layers), *tile, config));
+ callback(worker->parseAllLayers(std::move(layers), std::move(tile), config));
} catch (...) {
callback(std::current_exception());
}