From 0603d8f5e3e152c40bd833b08d9ea4b6630f6e7a Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Tue, 24 Mar 2015 00:44:07 +0200 Subject: [PATCH] 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. --- src/mbgl/map/map.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 5cc08ace6..f64972ba5 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -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()); }