diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-06-30 15:39:41 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-06-30 15:39:41 +0300 |
commit | dc9a88629b4ba5f5564aec64971781d737e50946 (patch) | |
tree | 5b2e7d87f75daa396895c48722a39f1c55a87a7c /src | |
parent | 923ea1456a4558e75ca2653ffd42b4ad3d4ab27d (diff) | |
download | qtlocation-mapboxgl-dc9a88629b4ba5f5564aec64971781d737e50946.tar.gz |
Check if the style was loaded before rendering
We now drive rendering from the main thread calling renderSync(),
but if we do it just after we set the style URL it will assert
because renderSync() expects the style to be fully loaded.
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/map/map_context.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp index 823bff54a4..e1e57eac81 100644 --- a/src/mbgl/map/map_context.cpp +++ b/src/mbgl/map/map_context.cpp @@ -305,6 +305,11 @@ void MapContext::renderStill(const TransformState& state, StillImageCallback fn) bool MapContext::renderSync(const TransformState& state) { assert(util::ThreadContext::currentlyOn(util::ThreadType::Map)); + // Style was not loaded yet. + if (!style) { + return false; + } + transformState = state; // Cleanup OpenGL objects that we abandoned since the last render call. @@ -315,8 +320,6 @@ bool MapContext::renderSync(const TransformState& state) { return false; } - assert(style); - if (!painter) { painter = std::make_unique<Painter>(); painter->setup(); |