Commit 5a4155f0 by olly Committed by Oliver Woodman

Destroy EGLSurface during DummySurface cleanup

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168020525
parent 40d443dc
...@@ -35,6 +35,7 @@ import static android.opengl.EGL14.eglChooseConfig; ...@@ -35,6 +35,7 @@ import static android.opengl.EGL14.eglChooseConfig;
import static android.opengl.EGL14.eglCreateContext; import static android.opengl.EGL14.eglCreateContext;
import static android.opengl.EGL14.eglCreatePbufferSurface; import static android.opengl.EGL14.eglCreatePbufferSurface;
import static android.opengl.EGL14.eglDestroyContext; import static android.opengl.EGL14.eglDestroyContext;
import static android.opengl.EGL14.eglDestroySurface;
import static android.opengl.EGL14.eglGetDisplay; import static android.opengl.EGL14.eglGetDisplay;
import static android.opengl.EGL14.eglInitialize; import static android.opengl.EGL14.eglInitialize;
import static android.opengl.EGL14.eglMakeCurrent; import static android.opengl.EGL14.eglMakeCurrent;
...@@ -175,8 +176,9 @@ public final class DummySurface extends Surface { ...@@ -175,8 +176,9 @@ public final class DummySurface extends Surface {
private static final int MSG_RELEASE = 3; private static final int MSG_RELEASE = 3;
private final int[] textureIdHolder; private final int[] textureIdHolder;
private EGLContext context;
private EGLDisplay display; private EGLDisplay display;
private EGLContext context;
private EGLSurface pbuffer;
private Handler handler; private Handler handler;
private SurfaceTexture surfaceTexture; private SurfaceTexture surfaceTexture;
...@@ -315,7 +317,7 @@ public final class DummySurface extends Surface { ...@@ -315,7 +317,7 @@ public final class DummySurface extends Surface {
EGL_HEIGHT, 1, EGL_HEIGHT, 1,
EGL_NONE}; EGL_NONE};
} }
EGLSurface pbuffer = eglCreatePbufferSurface(display, config, pbufferAttributes, 0); pbuffer = eglCreatePbufferSurface(display, config, pbufferAttributes, 0);
Assertions.checkState(pbuffer != null, "eglCreatePbufferSurface failed"); Assertions.checkState(pbuffer != null, "eglCreatePbufferSurface failed");
boolean eglMadeCurrent = eglMakeCurrent(display, pbuffer, pbuffer, context); boolean eglMadeCurrent = eglMakeCurrent(display, pbuffer, pbuffer, context);
...@@ -334,11 +336,15 @@ public final class DummySurface extends Surface { ...@@ -334,11 +336,15 @@ public final class DummySurface extends Surface {
glDeleteTextures(1, textureIdHolder, 0); glDeleteTextures(1, textureIdHolder, 0);
} }
} finally { } finally {
if (pbuffer != null) {
eglDestroySurface(display, pbuffer);
}
if (context != null) { if (context != null) {
eglDestroyContext(display, context); eglDestroyContext(display, context);
} }
display = null; pbuffer = null;
context = null; context = null;
display = null;
surface = null; surface = null;
surfaceTexture = null; surfaceTexture = null;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment