New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android Screen rotation crash #531
Comments
Possibly related: Backtrace when actually crashing:
Edit:
|
Okay, update - my previous assumption has been (partially) wrong. What I know now: When the screen rotates, the native window as well as the activity are destroyed and the app is restarted (I'm not sure that's intentional). In MainAndroid.cpp inside By resetting the pointer to Edit: My changes can be found in commit 27d2c7a. Feel free to toy around with it. |
If I remember correctly, adding to the manifest that the app handles screen rotations (or using a fixed orientation) gets rid of this behaviour. To be confirmed. |
It does, I just wasn't sure that's the behind-the-scenes difference (other than seeing the animation play and the screen resizing). |
The code is good enough, especially since, in the SFML context, no one should remove configChange:"orientation|screenSize" from his manifest file, and thus no one should run across this crash. Regular Android application (written in Java using the Android API, and thus at higher level) would want the system to reselect the appropriate resources and rebuild the entire UI according to the new screen size/orientation. That's why Android restart the whole activity by default when these events occur. Here, those reasons aren't applicable to a native Android application, and by consequences one should never prefer his whole app to restart when there's a screen rotation event or the screen size is modified. |
@sonkun can this issue be closed or is this not implemented yet? |
I've added orientation to configChanges and set screenOrientation="landscape" in my manifest, my app crashes with a segfault when exiting. The same crash happens when you rotate the screen as when you go to the home screen when your app is in landscape, the rotation back to portrait causes the segfault. If I disable landscape and use the home button from portrait orientation, no crash. Any idea why this is? |
What's the status of this? Didn't fix #641 the original issue? I'm no Android expert, but from what I understood, when people don't change the manifest, nothing will blow up? |
Haven't tested it lately, but it should. Even if not, wouldn't call it a blocking issue, just document the recommended manifest details (see Sonkun's post above) somewhere. |
Alright, thanks again. I set this to 2.x. I know that @sonkun is assigned, but since this only triggers when people change the manifest, and regarding the fact that the iOS and Android ports are not even stable/complete, I think this is an acceptable solution for pushing 2.2 forward. If someone wants to fix this for 2.2 in a reasonable amount of time, then I guess nobody has something against it. But this and the other related issues have been around for months, so I think postponing them is a valid consequence. |
Removed milestone due to missing progress. |
Is this still a bug or was it fixed a long time ago and the issue was forgotten? (Probably @MarioLiebisch knows?) |
It's an edge case. This more or less only is an issue if you don't try to handle rotation inside SFML (same with #644). Proper documentation can "fix" this (as commented above). |
Hi,
When the smartphone is rotated, the app crash came with backtrace : http://pastebin.com/DepbhSvE
My code is the code of android samples.
Lib compiled with NDK rev 9c and android gcc 4.8 + stlport
The text was updated successfully, but these errors were encountered: