Skip to content Skip to sidebar Skip to footer

Eglcreatewindowsurface Fails With Java.lang.illegalargumentexception

When trying to press the back button quickly during launching some Activities with GLSurfaceView, eglCreateWindowSurface fails with java.lang.IllegalArgumentException. I got the fo

Solution 1:

Switching between multiple Activities quickly torn window surface down.

I patched GLSurfaceView.guardedRun() to avoid race condition of GLSurfaceView

from:

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;
                }

to:

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;
                }

It looks to me like this problem was fixed in JellyBean.

Solution 2:

I had the same problem and fixed it by setting a callback for surfaceDestroyed and calling super.surfaceDestroyed.

glSurfaceView = newGLSurfaceView(context) {
    publicvoidsurfaceDestroyed(SurfaceHolder holder) {
        super.surfaceDestroyed(holder);
    }
};

Post a Comment for "Eglcreatewindowsurface Fails With Java.lang.illegalargumentexception"