Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] Refcount the view activations
Browse files Browse the repository at this point in the history
Fixes #5836
Fixes #5721
  • Loading branch information
tmpsantos committed Aug 5, 2016
1 parent cf047b4 commit 45c5e04
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions platform/android/src/native_map_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -151,6 +155,10 @@ void NativeMapView::activate() {
}

void NativeMapView::deactivate() {
if (--active) {
return;
}

mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::deactivate");

assert(vm != nullptr);
Expand Down
2 changes: 2 additions & 0 deletions platform/android/src/native_map_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class NativeMapView : public mbgl::View, private mbgl::util::noncopyable {
std::unique_ptr<mbgl::DefaultFileSource> fileSource;
std::unique_ptr<mbgl::Map> map;
mbgl::EdgeInsets insets;

unsigned active = 0;
};
}
}

0 comments on commit 45c5e04

Please sign in to comment.