diff --git a/android/cpp/native_map_view.cpp b/android/cpp/native_map_view.cpp index 5f6b078a7..327d1dc59 100644 --- a/android/cpp/native_map_view.cpp +++ b/android/cpp/native_map_view.cpp @@ -360,7 +360,7 @@ void NativeMapView::createSurface(ANativeWindow *window_) { void NativeMapView::destroySurface() { mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::destroySurface"); - pause(true); + pause(); if (surface != EGL_NO_SURFACE) { if (!eglDestroySurface(display, surface)) { @@ -674,12 +674,11 @@ void loadExtensions() { } } -void NativeMapView::pause(bool waitForPause) { - mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::pause %s", - (waitForPause) ? "true" : "false"); +void NativeMapView::pause() { + mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::pause"); if ((display != EGL_NO_DISPLAY) && (context != EGL_NO_CONTEXT)) { - map.pause(waitForPause); + map.pause(); } } diff --git a/include/mbgl/android/native_map_view.hpp b/include/mbgl/android/native_map_view.hpp index a050ad149..c6f0c7b35 100644 --- a/include/mbgl/android/native_map_view.hpp +++ b/include/mbgl/android/native_map_view.hpp @@ -40,7 +40,7 @@ public: void destroySurface(); void resume(); - void pause(bool waitForPause = false); + void pause(); void enableFps(bool enable); void updateFps(); diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index a15da5178..5dc463f24 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -36,7 +36,7 @@ public: ~Map(); // Pauses the render thread. The render thread will stop running but will not be terminated and will not lose state until resumed. - void pause(bool waitForPause = false); + void pause(); // Resumes a paused render thread void resume(); diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 0464ed3f1..3c1dcdd14 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -20,15 +20,12 @@ Map::~Map() { resume(); } -void Map::pause(bool waitForPause) { +void Map::pause() { assert(data->mode == MapMode::Continuous); std::unique_lock lockPause(data->mutexPause); context->invoke(&MapContext::pause); - - if (waitForPause) { - data->condPaused.wait(lockPause); - } + data->condPaused.wait(lockPause); } void Map::resume() { diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp index e72a17480..f655c9b0b 100644 --- a/src/mbgl/map/map_context.cpp +++ b/src/mbgl/map/map_context.cpp @@ -77,6 +77,8 @@ MapContext::~MapContext() { } void MapContext::pause() { + MBGL_CHECK_ERROR(glFinish()); + view.deactivate(); std::unique_lock lockPause(data.mutexPause);