From 5fc2e015317620476ab57d435c886f6348f0ac05 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 28 Jul 2014 18:39:29 -0700 Subject: [PATCH] fix geojson plugin by avoiding static const grammar for now --- plugins/input/geojson/geojson_datasource.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/input/geojson/geojson_datasource.cpp b/plugins/input/geojson/geojson_datasource.cpp index 8a4f4158a..aec7a52ef 100644 --- a/plugins/input/geojson/geojson_datasource.cpp +++ b/plugins/input/geojson/geojson_datasource.cpp @@ -155,9 +155,12 @@ void geojson_datasource::parse_geojson(T & stream) boost::spirit::multi_pass end = boost::spirit::make_default_multi_pass(base_iterator_type()); + // FIXME - for perf we need to declare grammar as 'static const' + // but we cannot because then all features will interact only with the first context_ptr + // created in the process which leads to very odd bugs mapnik::context_ptr ctx = std::make_shared(); - static const mapnik::transcoder tr("utf8"); - static const mapnik::json::feature_collection_grammar,mapnik::feature_impl> fc_grammar(ctx, tr); + mapnik::transcoder tr("utf8"); + mapnik::json::feature_collection_grammar,mapnik::feature_impl> fc_grammar(ctx, tr); boost::spirit::standard_wide::space_type space; bool result = boost::spirit::qi::phrase_parse(begin, end, fc_grammar, space, features_); if (!result)