summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-05-12 16:11:15 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-05-13 19:01:58 -0700
commit7d4f12434e393558344d053dc5809ce586d3fbbd (patch)
tree9a1f55c52fedbb2a5a8c76bbab44f920d7915918 /android
parenta2344c36c372445ee230832a0b742ac5ee739eb1 (diff)
downloadqtlocation-mapboxgl-7d4f12434e393558344d053dc5809ce586d3fbbd.tar.gz
Ensure call-once semantics inside InitializeExtensions
Diffstat (limited to 'android')
-rw-r--r--android/cpp/native_map_view.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/android/cpp/native_map_view.cpp b/android/cpp/native_map_view.cpp
index 4cd1669ef9..03530aefff 100644
--- a/android/cpp/native_map_view.cpp
+++ b/android/cpp/native_map_view.cpp
@@ -17,10 +17,6 @@
#include <mbgl/platform/gl.hpp>
#include <mbgl/util/std.hpp>
-#include <pthread.h>
-
-pthread_once_t loadGLExtensions = PTHREAD_ONCE_INIT;
-
namespace mbgl {
namespace android {
@@ -308,8 +304,6 @@ void NativeMapView::terminateContext() {
context = EGL_NO_CONTEXT;
}
-void loadExtensions();
-
void NativeMapView::createSurface(ANativeWindow *window_) {
mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::createSurface");
@@ -349,9 +343,11 @@ void NativeMapView::createSurface(ANativeWindow *window_) {
"SL Version"); // In the emulator this returns NULL with error code 0?
// https://code.google.com/p/android/issues/detail?id=78977
}
- log_gl_string(GL_EXTENSIONS, "Extensions");
- pthread_once(&loadGLExtensions, loadExtensions);
+ log_gl_string(GL_EXTENSIONS, "Extensions");
+ mbgl::gl::InitializeExtensions([] (const char * name) {
+ return reinterpret_cast<mbgl::gl::glProc>(eglGetProcAddress(name));
+ });
if (!eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) {
mbgl::Log::Error(mbgl::Event::OpenGL,
@@ -584,12 +580,6 @@ EGLConfig NativeMapView::chooseConfig(const EGLConfig configs[], EGLint numConfi
return configId;
}
-void loadExtensions() {
- mbgl::gl::InitializeExtensions([] (const char * name) {
- return reinterpret_cast<mbgl::gl::glProc>(eglGetProcAddress(name));
- });
-}
-
void NativeMapView::pause() {
mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::pause");