summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorBrad Leege <bleege@gmail.com>2015-05-11 11:42:21 -0500
committerBrad Leege <bleege@gmail.com>2015-05-11 11:42:21 -0500
commitd4fcb5bb98ed932f2bfe9d1fec09990ef6377253 (patch)
treef4ba1b65ff887c18fc7974257cb28921eb73b90c /android
parent9a233c7ed295a73da1abf3a7feffe6eec2cf9963 (diff)
parent703e0bc2ee609a59e90b7ba3ddefffaf17291bf4 (diff)
downloadqtlocation-mapboxgl-d4fcb5bb98ed932f2bfe9d1fec09990ef6377253.tar.gz
Merge pull request #1469 from mapbox/1435-android-gl-crash
Android GL Crash
Diffstat (limited to 'android')
-rw-r--r--android/cpp/native_map_view.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/android/cpp/native_map_view.cpp b/android/cpp/native_map_view.cpp
index 327d1dc598..be07ba50e5 100644
--- a/android/cpp/native_map_view.cpp
+++ b/android/cpp/native_map_view.cpp
@@ -61,9 +61,11 @@ NativeMapView::NativeMapView(JNIEnv *env, jobject obj_)
: mbgl::View(*this),
fileCache(mbgl::android::cachePath + "/mbgl-cache.db"),
fileSource(&fileCache),
- map(*this, fileSource, MapMode::Continuous, true) {
+ map(*this, fileSource, MapMode::Continuous) {
mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::NativeMapView");
+ map.pause();
+
assert(env != nullptr);
assert(obj_ != nullptr);
@@ -116,10 +118,14 @@ void NativeMapView::activate() {
void NativeMapView::deactivate() {
mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::deactivate");
- 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",
- eglGetError());
- throw new std::runtime_error("eglMakeCurrent() failed");
+ if (display != EGL_NO_DISPLAY) {
+ 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",
+ eglGetError());
+ throw new std::runtime_error("eglMakeCurrent() failed");
+ }
+ } else {
+ mbgl::Log::Info(mbgl::Event::Android, "Not deactivating as we are not ready");
}
}