diff options
author | Jordan Hollinger <jhollinger2@gmail.com> | 2014-11-19 11:23:06 -0800 |
---|---|---|
committer | Jordan Hollinger <jhollinger2@gmail.com> | 2014-11-19 11:23:06 -0800 |
commit | 9c944731a2a3c48b347328f32dbee4514e8a972b (patch) | |
tree | e4021488eb079ae3194edcfe9e6f5a35d8b1bb4a /android/cpp/native_map_view.cpp | |
parent | 9dbcb69227d87fd1e88160567b2c0e95430d6855 (diff) | |
download | qtlocation-mapboxgl-9c944731a2a3c48b347328f32dbee4514e8a972b.tar.gz |
Destory surface prior to destroying the view. #615
Diffstat (limited to 'android/cpp/native_map_view.cpp')
-rw-r--r-- | android/cpp/native_map_view.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/android/cpp/native_map_view.cpp b/android/cpp/native_map_view.cpp index 3997d91763..009e62b800 100644 --- a/android/cpp/native_map_view.cpp +++ b/android/cpp/native_map_view.cpp @@ -234,6 +234,14 @@ void NativeMapView::terminateDisplay() { mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::terminateDisplay"); if (display != EGL_NO_DISPLAY) { + // Destroy the surface first, if it still exists. This call needs a valid surface. + if (surface != EGL_NO_SURFACE) { + if (!eglDestroySurface(display, surface)) { + mbgl::Log::Error(mbgl::Event::OpenGL, "eglDestroySurface() returned error %d", eglGetError()); + } + surface = EGL_NO_SURFACE; + } + if (!eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) { mbgl::Log::Error(mbgl::Event::OpenGL, "eglMakeCurrent(EGL_NO_CONTEXT) returned error %d", @@ -541,7 +549,7 @@ void NativeMapView::loadExtensions() { void NativeMapView::stop() { mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::stop"); - if ((display != EGL_NO_DISPLAY) && (display != EGL_NO_CONTEXT)) { + if ((display != EGL_NO_DISPLAY) && (context != EGL_NO_CONTEXT)) { map.stop(); } } @@ -550,7 +558,7 @@ void NativeMapView::stop() { void NativeMapView::pause(bool wait_for_pause) { mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::pause %s", (wait_for_pause) ? "true" : "false"); - if ((display != EGL_NO_DISPLAY) && (display != EGL_NO_CONTEXT)) { + if ((display != EGL_NO_DISPLAY) && (context != EGL_NO_CONTEXT)) { map.pause(wait_for_pause); } } |