hi, im getting a few reports of a crash on android devices that i couldn’t reproduce.
sdl version 2.0.9
crash in SDL_GetWindowSize_REAL - signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)
maybe im not getting the screen size the proper way?
this is the short version of init sdl,window,gl
if(SDL_Init(SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS) == 0)
{
window = SDL_CreateWindow("game", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_FULLSCREEN | SDL_WINDOW_OPENGL)
glcontext = SDL_GL_CreateContext(window);
}
this is part of the call stack where i get the screen size:
Vector2 Game::GetScreenSize()
{
int w = 0;
int h = 0;
SDL_GetWindowSize(window, &w, &h);
return Vector2(w, h);
}
the first line in this void (CHECK_WINDOW_MAGIC) is where addr2line points to in the first line of the call stack as the crash source:
line 2033 in SDL_video.c
void
SDL_GetWindowSize(SDL_Window * window, int *w, int *h)
{
CHECK_WINDOW_MAGIC(window,);
if (w) {
*w = window->w;
}
if (h) {
*h = window->h;
}
}
the crash log in google play console:
backtrace:
#00 pc 0000000000085ab6 /data/app/package.name-1/lib/arm/libSDL2.so (SDL_GetWindowSize_REAL+13)
#01 pc 0000000000076c9f /data/app/package.name-1/lib/arm/libmain.so (_ZN4Game13GetScreenSizeEv+30)
#02 pc 000000000008f863 /data/app/package.name-1/lib/arm/libmain.so (_ZN6Sprite6RenderEv+130)
#03 pc 00000000000777cb /data/app/package.name-1/lib/arm/libmain.so (_ZN4Game6renderEv+930)
#04 pc 0000000000078c9b /data/app/package.name-1/lib/arm/libmain.so (SDL_main+106)
#05 pc 0000000000029375 /data/app/package.name-1/lib/arm/libSDL2.so (Java_org_libsdl_app_SDLActivity_nativeRunMain+356)
#06 pc 00000000006907ed /data/app/package.name-1/oat/arm/base.odex