summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-11-28 18:42:11 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-11-29 09:53:28 +0200
commitab5572b0bc3d386893592b842ad58b356b227a5d (patch)
treee14700c46659a4d57e7e67dfd029b925b3e7331d
parentcd4136ed4b4fc5d9a44fe17aa98dfd590c9c0bfb (diff)
downloadqtlocation-mapboxgl-ab5572b0bc3d386893592b842ad58b356b227a5d.tar.gz
[core] Fix supercluster lambdas capturing
-rw-r--r--src/mbgl/style/sources/geojson_source_impl.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mbgl/style/sources/geojson_source_impl.cpp b/src/mbgl/style/sources/geojson_source_impl.cpp
index f716b81c5b..962d6bd060 100644
--- a/src/mbgl/style/sources/geojson_source_impl.cpp
+++ b/src/mbgl/style/sources/geojson_source_impl.cpp
@@ -91,24 +91,24 @@ std::shared_ptr<GeoJSONData> GeoJSONData::create(const GeoJSON& geoJSON, Immutab
clusterOptions.maxZoom = options->clusterMaxZoom;
clusterOptions.extent = util::EXTENT;
clusterOptions.radius = ::round(scale * options->clusterRadius);
- Feature feature;
- clusterOptions.map = [&, options](const PropertyMap& properties) -> PropertyMap {
+ auto feature = std::make_shared<Feature>();
+ clusterOptions.map = [feature, options](const PropertyMap& properties) -> PropertyMap {
PropertyMap ret{};
if (properties.empty()) return ret;
for (const auto& p : options->clusterProperties) {
- feature.properties = properties;
- ret[p.first] = evaluateFeature<Value>(feature, p.second.first);
+ feature->properties = properties;
+ ret[p.first] = evaluateFeature<Value>(*feature, p.second.first);
}
return ret;
};
- clusterOptions.reduce = [&, options](PropertyMap& toReturn, const PropertyMap& toFill) {
+ clusterOptions.reduce = [feature, options](PropertyMap& toReturn, const PropertyMap& toFill) {
for (const auto& p : options->clusterProperties) {
if (toFill.count(p.first) == 0) {
continue;
}
- feature.properties = toFill;
+ feature->properties = toFill;
optional<Value> accumulated(toReturn[p.first]);
- toReturn[p.first] = evaluateFeature<Value>(feature, p.second.second, accumulated);
+ toReturn[p.first] = evaluateFeature<Value>(*feature, p.second.second, accumulated);
}
};
return std::make_shared<SuperclusterData>(geoJSON.get<mapbox::feature::feature_collection<double>>(),