SFML community forums

Help => General => Topic started by: maxwell79 on October 16, 2015, 12:07:19 pm

Title: Android Demo Code Segfaults or Freezes on Exit
Post by: maxwell79 on October 16, 2015, 12:07:19 pm
Has anyone else found the demo android code to be buggy?

Although it runs, the App doesn't close when you press the back button.
 
The only response I could get was by changing the exit event to be a "KeyPressed". This closes the app but results in  either a segmentation fault or the app just freezes (seemingly stuck in one of ths loops in MainAndroid.cpp).

Code to reproduce this can be found here:
 https://github.com/misopeth/SfmlTry

I've running Android 4.4.2 and AndroidNDK 10.
Title: Re: Android Demo Code Segfaults or Freezes on Exit
Post by: DragonRock on January 02, 2016, 12:21:07 pm
Yes, I also have some problems with this.

However, when I use your example, my app does return (my android goes back to the menu of apps), but if I try to start it again, none of the main function is executed, I get a black screen with the title of the window at the top.

Should we open an issue on github ?
Title: Re: Android Demo Code Segfaults or Freezes on Exit
Post by: Mario on January 03, 2016, 09:16:45 am
I think the "crash when closing" is a race condition on some devices. Haven't had any time to look into the Android build in general, but I want to change a few things around regarding the native activity as well as linking/launching anyway.

Edit:

When you call window.close();, leave both your event loop and the main loop. Don't try to continue event handling, drawing, etc. as things will get torn down. I'm not 100% sure and I haven't tried yet, but this sounds like one possible source for your problems.