diff options
author | Łukasz Paczos <lukas.paczos@gmail.com> | 2019-08-12 15:28:27 +0200 |
---|---|---|
committer | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2019-08-19 13:32:20 +0200 |
commit | 1846c0582db56d808220a749c7ee0a3845b0a521 (patch) | |
tree | 7f7db17651595ca2b5278a195cc3624ec700513a | |
parent | 0bdc5a255841785e5aca3b68559c1532d7853f72 (diff) | |
download | qtlocation-mapboxgl-1846c0582db56d808220a749c7ee0a3845b0a521.tar.gz |
[android] synchronize TextureView EGL context creation
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java index 165b15a512..205e35641b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java @@ -5,9 +5,13 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.UiThread; import android.view.TextureView; + import com.mapbox.mapboxsdk.log.Logger; import com.mapbox.mapboxsdk.maps.renderer.egl.EGLConfigChooser; +import java.lang.ref.WeakReference; +import java.util.ArrayList; + import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGL11; import javax.microedition.khronos.egl.EGLConfig; @@ -15,8 +19,6 @@ import javax.microedition.khronos.egl.EGLContext; import javax.microedition.khronos.egl.EGLDisplay; import javax.microedition.khronos.egl.EGLSurface; import javax.microedition.khronos.opengles.GL10; -import java.lang.ref.WeakReference; -import java.util.ArrayList; /** * The render thread is responsible for managing the communication between the @@ -250,13 +252,13 @@ class TextureViewRenderThread extends Thread implements TextureView.SurfaceTextu // Initialize EGL if (initializeEGL) { eglHolder.prepare(); - if (!eglHolder.createSurface()) { - synchronized (lock) { + synchronized (lock) { + if (!eglHolder.createSurface()) { // Cleanup the surface if one could not be created // and wait for another to be ready. destroySurface = true; + continue; } - continue; } mapRenderer.onSurfaceCreated(gl, eglHolder.eglConfig); mapRenderer.onSurfaceChanged(gl, w, h); @@ -265,7 +267,9 @@ class TextureViewRenderThread extends Thread implements TextureView.SurfaceTextu // If the surface size has changed inform the map renderer. if (recreateSurface) { - eglHolder.createSurface(); + synchronized (lock) { + eglHolder.createSurface(); + } mapRenderer.onSurfaceChanged(gl, w, h); continue; } |