eglCreateWindowSurface

eglCreateWindowSurface

本文介绍了eglCreateWindowSurface失败,java.lang.IllegalArgumentException异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在工作期间,快速推出一些活动, GLSurfaceView eglCreateWindowSurface 试图preSS后退按钮失败, java.lang.IllegalArgumentException异常

When trying to press the back button quickly during launching some Activities with GLSurfaceView, eglCreateWindowSurface fails with 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)

这些活动之前没有援引GL操作 SurfaceHolder.Callback.surfaceCreated 或之后 SurfaceHolder.Callback.surfaceDestroyed

These activities didn't invoke GL operations before SurfaceHolder.Callback.surfaceCreated or after SurfaceHolder.Callback.surfaceDestroyed.

有没有其他人遇到这一点,有什么解决办法?

Has anyone else run into this, and what's the solution?

感谢您的任何进展。

推荐答案

迅速撕开窗表面的多个活动之间的切换了。

Switching between multiple Activities quickly torn window surface down.

我修改 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在软糖。

这篇关于eglCreateWindowSurface失败,java.lang.IllegalArgumentException异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-16 19:07