From e00bae4f1c9fed201dd01f641f7849d4178e0e7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Wed, 11 Feb 2015 13:56:16 -0800 Subject: [PATCH] lock the StyleBucket to avoid crashing stopgap until we have a solution that doesn't mutate the style objects while parsing a tile --- include/mbgl/map/map.hpp | 2 +- src/mbgl/map/map.cpp | 4 ++++ src/mbgl/map/vector_tile_data.cpp | 1 + src/mbgl/style/style_bucket.hpp | 8 ++++---- src/mbgl/style/style_parser.cpp | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index ed156c5d2..8711aa3d0 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -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(); diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 73e188848..518bc5bb9 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -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(); diff --git a/src/mbgl/map/vector_tile_data.cpp b/src/mbgl/map/vector_tile_data.cpp index 40fc7badf..68974aadf 100644 --- a/src/mbgl/map/vector_tile_data.cpp +++ b/src/mbgl/map/vector_tile_data.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include diff --git a/src/mbgl/style/style_bucket.hpp b/src/mbgl/style/style_bucket.hpp index 17924490b..b79b324b0 100644 --- a/src/mbgl/style/style_bucket.hpp +++ b/src/mbgl/style/style_bucket.hpp @@ -1,23 +1,23 @@ #ifndef MBGL_STYLE_STYLE_BUCKET #define MBGL_STYLE_STYLE_BUCKET -#include #include -#include #include -#include #include +#include +#include namespace mbgl { -class Source; +class StyleSource; class StyleBucket : public util::noncopyable { public: typedef util::ptr Ptr; inline StyleBucket(StyleLayerType type_) : type(type_) {} + const StyleLayerType type; std::string name; util::ptr style_source; diff --git a/src/mbgl/style/style_parser.cpp b/src/mbgl/style/style_parser.cpp index 4745cf283..930f46d30 100644 --- a/src/mbgl/style/style_parser.cpp +++ b/src/mbgl/style/style_parser.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -319,7 +320,6 @@ template <> inline float defaultBaseValue() { return 1.0; } template std::tuple> StyleParser::parseFunction(JSVal value, const char *property_name) { - if (!value.IsObject()) { return std::tuple> { true, ConstantFunction(std::get<1>(parseProperty(value, property_name))) }; }