Fix crash on debug build

styleInfo is being passed to request() by reference but it is stack
allocated and goes out of scope. Pass the bits we are interested by
value instead.
This commit is contained in:
Thiago Marcos P. Santos
2015-03-24 00:44:07 +02:00
parent 77c386251e
commit 0603d8f5e3

View File

@@ -719,10 +719,11 @@ void Map::reloadStyle() {
const auto styleInfo = data->getStyleInfo();
if (!styleInfo.url.empty()) {
const auto base = styleInfo.base;
// We have a style URL
env->request({ Resource::Kind::JSON, styleInfo.url }, [&](const Response &res) {
env->request({ Resource::Kind::JSON, styleInfo.url }, [this, base](const Response &res) {
if (res.status == Response::Successful) {
loadStyleJSON(res.data, styleInfo.base);
loadStyleJSON(res.data, base);
} else {
Log::Error(Event::Setup, "loading style failed: %s", res.message.c_str());
}