diff options
author | Ansis Brammanis <ansis.brammanis@gmail.com> | 2019-04-02 12:57:45 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-02 12:57:45 -0400 |
commit | 2455275bf47e1671a92eb2c1296c6b48f11f6b2e (patch) | |
tree | ad027661edc899feae56ad8b50ebd208f7a36d12 /platform/darwin/src/MGLRendererFrontend.h | |
parent | 805b1402452da74042b995d693c48ee4b79ae337 (diff) | |
download | qtlocation-mapboxgl-2455275bf47e1671a92eb2c1296c6b48f11f6b2e.tar.gz |
add onStyleImageMissing to allow dynamically loaded or generated images (#14253)
Also make `Style#updateImage(...)` much faster when the image doesn't change size. This can be useful for asynchronously generating images.
Diffstat (limited to 'platform/darwin/src/MGLRendererFrontend.h')
-rw-r--r-- | platform/darwin/src/MGLRendererFrontend.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/platform/darwin/src/MGLRendererFrontend.h b/platform/darwin/src/MGLRendererFrontend.h index 2df67ca4e4..c0e03351c6 100644 --- a/platform/darwin/src/MGLRendererFrontend.h +++ b/platform/darwin/src/MGLRendererFrontend.h @@ -49,7 +49,12 @@ public: mbgl::BackendScope guard { mbglBackend, mbgl::BackendScope::ScopeType::Implicit }; - renderer->render(*updateParameters); + // onStyleImageMissing might be called during a render. The user implemented method + // could trigger a call to MGLRenderFrontend#update which overwrites `updateParameters`. + // Copy the shared pointer here so that the parameters aren't destroyed while `render(...)` is + // still using them. + auto updateParameters_ = updateParameters; + renderer->render(*updateParameters_); } mbgl::Renderer* getRenderer() { |