Hi,
Have some issues with pause/resume on Android (tested on
Emulator API level 16, 4.1.2 and two real devices also with
Android 4.xxx).
The application creates a window, surface, texture and
renderer. The surface->pixels is used as drawing buffer then
I call
SDL_UpdateTexture(texture, NULL, surface->pixels, surface->pitch);
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, texture, NULL, NULL);
SDL_RenderPresent(renderer);
to update the window.
This works fine as long as application is in focus, but on
pause/resume if I don’t handle
SDL_APP_[DID/WILL]ENTER[FORE/BACK]GROUND events the screen
after resume is black, even if I try to update the window.
The app is still running and I can see in the logs that
events are handled.
I tried to recreate window when application enters the
foreground again (destroy all old objects and create new
ones) but then I get a crash:
backtrace:
#00 pc 000730e6 libSDL2.so (SDL_EGL_CreateSurface+9)
#01 pc 0007cc07 libSDL2.so (Android_CreateWindow+154)
#02 pc 0007c3f1 libSDL2.so (SDL_CreateWindow+396)
#03 pc 0001fbe5 libmain.so (init(unsigned int, unsigned int, unsigned int)+164)
bellow some traces before the crash:
I/jni/src/agg-2.5/src/platform/sdl2/agg_platform_support.cpp( 688): SDL_APP_WILLENTERBACKGROUND
I/jni/src/agg-2.5/src/platform/sdl2/agg_platform_support.cpp( 688): SDL_APP_DIDENTERBACKGROUND
V/SDL ( 688): onWindowFocusChanged(): false
W/EGL_emulation( 254): eglSurfaceAttrib not implemented
V/SDL ( 688): surfaceDestroyed()
W/EGL_emulation( 206): eglSurfaceAttrib not implemented
V/SDL ( 688): onResume()
V/SDL ( 688): surfaceCreated()
V/SDL ( 688): surfaceChanged()
V/SDL ( 688): pixel format RGB_565
V/SDL ( 688): Window size:800x1216
D/ ( 149): HostConnection::get() New Host Connection established 0x2a3b8e00, tid 160
V/SDL ( 688): onWindowFocusChanged(): true
V/SDL ( 688): nativeResume()
E/EGL_emulation( 688): tid 702: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
E/libEGL ( 688): eglMakeCurrent:534 error 3002 (EGL_BAD_ACCESS)
I/jni/src/agg-2.5/src/platform/sdl2/agg_platform_support.cpp( 688): SDL_APP_WILLENTERFOREGROUND
I/jni/src/agg-2.5/src/platform/sdl2/agg_platform_support.cpp( 688): SDL_APP_DIDENTERFOREGROUND
E/EGL_emulation( 688): tid 702: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
E/libEGL ( 688): eglMakeCurrent:534 error 3002 (EGL_BAD_ACCESS)
E/libEGL ( 688): call to OpenGL ES API with no current context (logged once per thread)
E/EGL_emulation( 688): tid 702: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
E/libEGL ( 688): eglMakeCurrent:534 error 3002 (EGL_BAD_ACCESS)
W/libEGL ( 688): eglTerminate() called w/ 3 objects remaining
//this will recreate the window.
I/jni/src/agg-2.5/src/platform/sdl2/agg_platform_support.cpp( 688): platform_support::init 800,1216,161
F/libc ( 688): Fatal signal 11 (SIGSEGV) at 0x00000008
(code=1), thread 702 (SDLThread)
I/DEBUG ( 33): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 33): Build fingerprint: 'generic/sdk/generic:4.1.2/MASTER/495790:eng/test-keys’
I/DEBUG ( 33): pid: 688, tid: 702, name: UNKNOWN >>> com.traffar.game_of_life <<<
I/DEBUG ( 33): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000008
Could You give me some hints how this could be solved?
Thanks!
Przemek