[android] crash: null display member in surfaceDestroyed

running the vanilla SDLActivity sample project on an Asus Memo pad under Android 4.1.1, the app runs but crashes when the home button is pressed. logcat shows an illegalParameterException:

Code:
V/SDL ( 4733): surfaceDestroyed()
V/SDL ( 4733): calling egl.eglMakeCurrent on display (null)
D/AndroidRuntime( 4733): Shutting down VM
W/dalvikvm( 4733): threadid=1: thread exiting with uncaught exception (group=0x40c53300)
E/AndroidRuntime( 4733): FATAL EXCEPTION: main
E/AndroidRuntime( 4733): java.lang.IllegalArgumentException
E/AndroidRuntime( 4733): at com.google.android.gles_jni.EGLImpl.eglMakeCurrent(Native Method)
E/AndroidRuntime( 4733): at org.libsdl.app.SDLSurface.surfaceDestroyed(SDLActivity.java:627)

i modified SDLActivity.java to print the member passed to eglMakeCurrent like this:

Code:
Log.v(“SDL”, “calling egl.eglMakeCurrent on display (” + SDLActivity.mEGLDisplay + “)”);
egl.eglMakeCurrent(SDLActivity.mEGLDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);

as the logcat output shows, the mEGLDisplay member is null.

no idea why and guessing it must be related to my specific hardware. wrapping the calls to eglMakeCurrent and eglDestroySurface in an if display != null seems to work in a quick test.

this is just fyi since i don’t have the the knowledge or time to help move SDL forward on android right now.

FYI, all that code has been removed in HG, and now the Android backend uses
the common EGL code (handled from the native side vs being handled from the
Java side). Hopefully this issue is already fixed, but it would be great if
you can confirm that. Thanks!

2013/9/17 carl <carl.lefrancois at gmail.com>> **

running the vanilla SDLActivity sample project on an Asus Memo pad under
Android 4.1.1, the app runs but crashes when the home button is pressed.
logcat shows an illegalParameterException:

Code:

V/SDL ( 4733): surfaceDestroyed()
V/SDL ( 4733): calling egl.eglMakeCurrent on display (null)
D/AndroidRuntime( 4733): Shutting down VM
W/dalvikvm( 4733): threadid=1: thread exiting with uncaught exception
(group=0x40c53300)
E/AndroidRuntime( 4733): FATAL EXCEPTION: main
E/AndroidRuntime( 4733): java.lang.IllegalArgumentException
E/AndroidRuntime( 4733): at
com.google.android.gles_jni.EGLImpl.eglMakeCurrent(Native Method)
E/AndroidRuntime( 4733): at
org.libsdl.app.SDLSurface.surfaceDestroyed(SDLActivity.java:627)

i modified SDLActivity.java to print the member passed to eglMakeCurrent
like this:

Code:

     Log.v("SDL", "calling egl.eglMakeCurrent on display (" +

SDLActivity.mEGLDisplay + “)”);
egl.eglMakeCurrent(SDLActivity.mEGLDisplay, EGL10.EGL_NO_SURFACE,
EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);

as the logcat output shows, the mEGLDisplay member is null.

no idea why and guessing it must be related to my specific hardware.
wrapping the calls to eglMakeCurrent and eglDestroySurface in an if display
!= null seems to work in a quick test.

this is just fyi since i don’t have the the knowledge or time to help move
SDL forward on android right now.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.

gabomdq wrote:

FYI, all that code has been removed in HG, and now the Android backend uses the common EGL code (handled from the native side vs being handled from the Java side). Hopefully this issue is already fixed, but it would be great if you can confirm that. Thanks!


Gabriel.

Gabriel, i can confirm that with the latest code from HG the app runs ok on my hardware.

:slight_smile: so much for the idea that using the stable release is less work than using those dangerous beta sources.