| Summary: | [Android] Calling SDL_VideoInit after SDL_Init with no parameters crashes the app | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Joe LeVeque <joeleveque> |
| Component: | video | Assignee: | Sylvain <sylvain.becker> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | CC: | gabomdq |
| Version: | 2.0.0 | ||
| Hardware: | ARM | ||
| OS: | Android (All) | ||
Update: This seems to be related to calling SDL_Init() without SDL_INIT_VIDEO, and subsequently calling SDL_VideoInit(NULL) at a point later in code. I replaced the above with SDL_Init(SDL_INIT_EVERYTHING), and the problem disappears. There's a few changes coming in the EGL management code on Android (see #2037) that will hopefully reduce the crazyness of SDL on Android. Let's revisit this after that patch lands. Are you still seeing this issue? Since I found that calling SDL_Init(SDL_INIT_EVERYTHING) works without issue, I had been using that in my code. However, I just switched my code back to call SDL_Init() without SDL_INIT_VIDEO, and then call SDL_VideoInit(NULL) later, and unfortunately, the problem reappeared with the exact same symptoms and logcat output. I tried and it seems to be working. ( setting landscape in onCreate(), starting in portrait, using SDL_VideoInit(NULL)) This seems to be fixed in the latest SDL snapshot: http://www.libsdl.org/tmp/SDL-2.0.zip Please reopen this bug if you can reproduce this with the same output. Thanks! |
I'm trying to get my app to run in landscape mode only on Android. I tried setting the orientation in AndroidManifest.xml to no avail, so instead I added the following java code in onCreate(): // Force landscape orientation this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); This does force the orientation to rotate when the app starts, and appears to prevent the screen from rotating while the app is running - that's great. If my phone is already in landscape mode when I launch the app, the app runs fine. However, if the phone is in portrait mode when the app is launched, the app will start, but will be killed after a frame or two and I see the following in the logcat: E/libEGL(3988): call to OpenGL ES API with no current context (logged once per thread) D/dalvikvm(3988): threadid=15: thread exiting, not yet detached (count=0) I/WindowState(699): WIN DEATH: Window{41ca3af8 u0 SurfaceView} I/ActivityManager(699): Process <apk name> (pid 3988) has died. W/ActivityManager(699): Force removing ActivityRecord{41e487b0 u0 <activity name>}: app died, no saved state I/WindowState(699): WIN DEATH: Window{41c8b550 u0 <activity name>} So, it appears as though the OpenGL context is somehow getting trashed even though the context isn't getting created until after the rotation has been done. This appears to be a bug in SDL2. No evidence of a crash, and no stack trace is generated. It seems as though the app is somehow exiting normally. I'm willing to help find and fix this issue.