gpt4 book ai didi

android - eglCreateWindowSurface 因 java.lang.IllegalArgumentException 而失败

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:35:33 29 4
gpt4 key购买 nike

在使用 GLSurfaceView 启动某些 Activity 期间尝试快速按下后退按钮时, eglCreateWindowSurface失败 java.lang.IllegalArgumentException .

我遇到了以下错误:

10-08 18:05:36.490: E/GLSurfaceView(3440): eglCreateWindowSurface
10-08 18:05:36.490: E/GLSurfaceView(3440): java.lang.IllegalArgumentException: Make sure the SurfaceView or associated SurfaceHolder has a valid Surface
10-08 18:05:36.490: E/GLSurfaceView(3440): at com.google.android.gles_jni.EGLImpl._eglCreateWindowSurface(Native Method)
10-08 18:05:36.490: E/GLSurfaceView(3440): at com.google.android.gles_jni.EGLImpl.eglCreateWindowSurface(EGLImpl.java:90)
10-08 18:05:36.490: E/GLSurfaceView(3440): at android.opengl.GLSurfaceView$DefaultWindowSurfaceFactory.createWindowSurface(GLSurfaceView.java:798)
10-08 18:05:36.490: E/GLSurfaceView(3440): at android.opengl.GLSurfaceView$EglHelper.createSurface(GLSurfaceView.java:1065)
10-08 18:05:36.490: E/GLSurfaceView(3440): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1433)
10-08 18:05:36.490: E/GLSurfaceView(3440): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)

这些 Activity 在 SurfaceHolder.Callback.surfaceCreated 之前没有调用 GL 操作或在 SurfaceHolder.Callback.surfaceDestroyed 之后.

有没有其他人遇到过这个问题,解决方案是什么?

感谢任何预付款。

最佳答案

在多个 Activity 之间切换会快速撕裂窗口表面。

我修补了 GLSurfaceView.guardedRun() 以避免 GLSurfaceView 的竞争条件

来自:

                if (createEglSurface) {
if (LOG_SURFACE) {
Log.w("GLThread", "egl createSurface");
}
gl = (GL10) mEglHelper.createSurface(getHolder());
if (gl == null) {
// Couldn't create a surface. Quit quietly.
break;
}
sGLThreadManager.checkGLDriver(gl);
createEglSurface = false;
}

到:

                if (createEglSurface) {
if (LOG_SURFACE) {
Log.w("GLThread", "egl createSurface");
}
gl = (GL10) mEglHelper.createSurface(getHolder());
if (gl == null) {
// If we escape, GLThread ends up. Don't escape.
continue;
}
sGLThreadManager.checkGLDriver(gl);
createEglSurface = false;
}

在我看来这个问题是 fixed in JellyBean .

关于android - eglCreateWindowSurface 因 java.lang.IllegalArgumentException 而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12855103/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com