summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2016-08-05 16:21:30 +0300
committerIvo van Dongen <info@ivovandongen.nl>2016-08-06 12:58:59 -0400
commit0c460a5590788e5ec9535ad9aa32070525b27137 (patch)
tree93f3fde1c5e01b8b8eda9fde4d937cafd90e1e16 /platform/android
parent016157c39eca336721b768f8f182e8c30144ce85 (diff)
downloadqtlocation-mapboxgl-0c460a5590788e5ec9535ad9aa32070525b27137.tar.gz
[android] Refcount the view activations
Fixes #5836 Fixes #5721
Diffstat (limited to 'platform/android')
-rwxr-xr-xplatform/android/src/native_map_view.cpp8
-rwxr-xr-xplatform/android/src/native_map_view.hpp2
2 files changed, 10 insertions, 0 deletions
diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp
index 578e5d0033..385accfa9d 100755
--- a/platform/android/src/native_map_view.cpp
+++ b/platform/android/src/native_map_view.cpp
@@ -125,6 +125,10 @@ std::array<uint16_t, 2> 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 9b5af76dfe..7974f282d9 100755
--- a/platform/android/src/native_map_view.hpp
+++ b/platform/android/src/native_map_view.hpp
@@ -97,6 +97,8 @@ private:
std::unique_ptr<mbgl::DefaultFileSource> fileSource;
std::unique_ptr<mbgl::Map> map;
mbgl::EdgeInsets insets;
+
+ unsigned active = 0;
};
}
}