diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index 578e5d00332..385accfa9dd 100755 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -125,6 +125,10 @@ std::array NativeMapView::getFramebufferSize() const { } void NativeMapView::activate() { + if (active++) { + return; + } + mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::activate"); oldDisplay = eglGetCurrentDisplay(); @@ -151,6 +155,10 @@ void NativeMapView::activate() { } void NativeMapView::deactivate() { + if (--active) { + return; + } + mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::deactivate"); assert(vm != nullptr); diff --git a/platform/android/src/native_map_view.hpp b/platform/android/src/native_map_view.hpp index 9b5af76dfe4..7974f282d99 100755 --- a/platform/android/src/native_map_view.hpp +++ b/platform/android/src/native_map_view.hpp @@ -97,6 +97,8 @@ class NativeMapView : public mbgl::View, private mbgl::util::noncopyable { std::unique_ptr fileSource; std::unique_ptr map; mbgl::EdgeInsets insets; + + unsigned active = 0; }; } }