summaryrefslogtreecommitdiff
path: root/platform/android/src/map_renderer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/src/map_renderer.cpp')
-rw-r--r--platform/android/src/map_renderer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/platform/android/src/map_renderer.cpp b/platform/android/src/map_renderer.cpp
index f0273cee50..7fefa457b1 100644
--- a/platform/android/src/map_renderer.cpp
+++ b/platform/android/src/map_renderer.cpp
@@ -1,6 +1,7 @@
#include "map_renderer.hpp"
#include <mbgl/renderer/renderer.hpp>
+#include <mbgl/gfx/backend_scope.hpp>
#include <mbgl/util/shared_thread_pool.hpp>
#include <mbgl/util/run_loop.hpp>
@@ -159,6 +160,9 @@ void MapRenderer::onSurfaceCreated(JNIEnv&) {
// Lock as the initialization can come from the main thread or the GL thread first
std::lock_guard<std::mutex> lock(initialisationMutex);
+ // The GL context is already active if get a new surface.
+ gfx::BackendScope backendGuard { *backend, gfx::BackendScope::ScopeType::Implicit };
+
// The android system will have already destroyed the underlying
// GL resources if this is not the first initialization and an
// attempt to clean them up will fail