summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-08-12 13:13:45 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-08-24 13:06:23 -0700
commit079ddfc8e4a107d0801e84c0fd2f6118e1a501fc (patch)
treec1ae66a27750867ce3c1c072d94427777945fcc6 /src
parentad70cd30efe6befca858bc1c428fd95d82b3585a (diff)
downloadqtlocation-mapboxgl-079ddfc8e4a107d0801e84c0fd2f6118e1a501fc.tar.gz
[core] Create BackendScopes in Renderer, assert in Impl
This avoids a long series of reset() calls in the Impl.
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/renderer/renderer.cpp6
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp10
2 files changed, 7 insertions, 9 deletions
diff --git a/src/mbgl/renderer/renderer.cpp b/src/mbgl/renderer/renderer.cpp
index 9f4b897d6e..7e8c7e4e4c 100644
--- a/src/mbgl/renderer/renderer.cpp
+++ b/src/mbgl/renderer/renderer.cpp
@@ -15,7 +15,10 @@ Renderer::Renderer(RendererBackend& backend,
contextMode_, std::move(programCacheDir_))) {
}
-Renderer::~Renderer() = default;
+Renderer::~Renderer() {
+ BackendScope guard { impl->backend };
+ impl.reset();
+}
void Renderer::setObserver(RendererObserver* observer) {
impl->setObserver(observer);
@@ -72,6 +75,7 @@ void Renderer::dumpDebugLogs() {
}
void Renderer::onLowMemory() {
+ BackendScope guard { impl->backend };
impl->onLowMemory();
}
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index 18b0ab08f5..38b296b389 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -64,13 +64,7 @@ Renderer::Impl::Impl(RendererBackend& backend_,
}
Renderer::Impl::~Impl() {
- BackendScope guard { backend };
- glyphManager.reset();
- imageManager.reset();
- lineAtlas.reset();
- renderSources.reset();
- renderLayers.reset();
- staticData.reset();
+ assert(BackendScope::exists());
};
void Renderer::Impl::setObserver(RendererObserver* observer_) {
@@ -670,7 +664,7 @@ std::vector<Feature> Renderer::Impl::querySourceFeatures(const std::string& sour
}
void Renderer::Impl::onLowMemory() {
- BackendScope guard { backend };
+ assert(BackendScope::exists());
backend.getContext().performCleanup();
for (const auto& entry : renderSources) {
entry.second->onLowMemory();