lock the StyleBucket to avoid crashing

stopgap until we have a solution that doesn't mutate the style objects while parsing a tile
This commit is contained in:
Konstantin Käfer
2015-02-11 13:56:16 -08:00
parent cf235c6592
commit e00bae4f1c
5 changed files with 11 additions and 6 deletions

View File

@@ -101,7 +101,7 @@ public:
// Position
void moveBy(double dx, double dy, std::chrono::steady_clock::duration duration = std::chrono::steady_clock::duration::zero());
void setLatLng(LatLng latLng, std::chrono::steady_clock::duration duration = std::chrono::steady_clock::duration::zero());
inline const LatLng getLatLng() const { return state.getLatLng(); }
LatLng getLatLng() const;
void startPanning();
void stopPanning();
void resetPosition();

View File

@@ -416,6 +416,10 @@ void Map::setLatLng(LatLng latLng, std::chrono::steady_clock::duration duration)
update();
}
LatLng Map::getLatLng() const {
return state.getLatLng();
}
void Map::startPanning() {
transform.startPanning();
update();

View File

@@ -4,6 +4,7 @@
#include <mbgl/map/map.hpp>
#include <mbgl/style/style_layer.hpp>
#include <mbgl/style/style_bucket.hpp>
#include <mbgl/style/style_source.hpp>
#include <mbgl/geometry/glyph_atlas.hpp>
#include <mbgl/platform/log.hpp>

View File

@@ -1,23 +1,23 @@
#ifndef MBGL_STYLE_STYLE_BUCKET
#define MBGL_STYLE_STYLE_BUCKET
#include <mbgl/style/types.hpp>
#include <mbgl/style/filter_expression.hpp>
#include <mbgl/style/style_source.hpp>
#include <mbgl/style/class_properties.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/ptr.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/uv.hpp>
namespace mbgl {
class Source;
class StyleSource;
class StyleBucket : public util::noncopyable {
public:
typedef util::ptr<StyleBucket> Ptr;
inline StyleBucket(StyleLayerType type_) : type(type_) {}
const StyleLayerType type;
std::string name;
util::ptr<StyleSource> style_source;

View File

@@ -4,6 +4,7 @@
#include <mbgl/util/constants.hpp>
#include <mbgl/util/std.hpp>
#include <mbgl/util/vec.hpp>
#include <mbgl/util/uv_detail.hpp>
#include <mbgl/platform/log.hpp>
#include <csscolorparser/csscolorparser.hpp>
@@ -319,7 +320,6 @@ template <> inline float defaultBaseValue<Color>() { return 1.0; }
template <typename T>
std::tuple<bool, Function<T>> StyleParser::parseFunction(JSVal value, const char *property_name) {
if (!value.IsObject()) {
return std::tuple<bool, Function<T>> { true, ConstantFunction<T>(std::get<1>(parseProperty<T>(value, property_name))) };
}