Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Android Demo Code Segfaults or Freezes on Exit  (Read 2592 times)

0 Members and 1 Guest are viewing this topic.

maxwell79

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Android Demo Code Segfaults or Freezes on Exit
« 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.

DragonRock

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Android Demo Code Segfaults or Freezes on Exit
« Reply #1 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 ?

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Android Demo Code Segfaults or Freezes on Exit
« Reply #2 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.
« Last Edit: January 03, 2016, 09:18:39 am by Mario »