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

Author Topic: [RESOLVED][Android] Crash when paused  (Read 3266 times)

0 Members and 1 Guest are viewing this topic.

IsDaouda

  • Full Member
  • ***
  • Posts: 212
    • View Profile
    • Email
[RESOLVED][Android] Crash when paused
« on: March 06, 2018, 11:45:05 am »
Hello everyone,

I have a problem with SFML 2.4.0 when I pause my smartphone.

- When I launch the application, and I leave it with the Home button by putting the phone in standby everything works well when I restart (via the task menu).
- But from the moment I click the Standby button when the application is active it crashes.

So I decided to do the same test on Windows to see if I will have the same problem and I got this message in the console (on Windows the application did not stop).

Quote
Al lib: <EE> MMDevApiProc: WaitForSingleObjectEx error: 0x102

I did some research on google to find a way to solve this problem but nothing concrete.

Thank you in advance for your solutions.
« Last Edit: March 27, 2018, 10:47:52 am by IsD »

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: [Android] Crash when paused
« Reply #1 on: March 06, 2018, 08:26:31 pm »
Does the provided SFML example show the same behaviour on your phone?


AlexAUT

IsDaouda

  • Full Member
  • ***
  • Posts: 212
    • View Profile
    • Email
Re: [Android] Crash when paused
« Reply #2 on: March 07, 2018, 10:18:39 am »
No, it works without problems.

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: [Android] Crash when paused
« Reply #3 on: March 08, 2018, 06:42:26 pm »
Then you code has some flaw and we know nothing about it, so it is hard to help you  ;).

Try to remove parts of the code until the problem disappears, thats the only advice I can give in this situation.


AlexAUT

IsDaouda

  • Full Member
  • ***
  • Posts: 212
    • View Profile
    • Email
Re: [Android] Crash when paused
« Reply #4 on: March 09, 2018, 01:07:14 pm »
I followed your advice and I finally found where the problem came from.

Whenever you declare an object of type sf :: Sound, sf :: SoundBuffer or sf :: Music, when the machine is idle this error triggers.

On the windows os the application just displays a message in the console but on Android it spits.

I did the test with the example provided with the SFML lib and I had the same problem.

Is there a solution to work around this problem?

vikaskundu

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: [Android] Crash when paused
« Reply #5 on: March 17, 2018, 02:10:10 pm »
@IsD like Alex says, it's hard to present you with some proper solution because of lack of details. Please attach some error logs or something informative that can allow us to figure out the problem.

IsDaouda

  • Full Member
  • ***
  • Posts: 212
    • View Profile
    • Email
Re: [Android] Crash when paused
« Reply #6 on: March 22, 2018, 06:19:28 pm »
When I'm doing the test with the AVD emulator and simulating the eve of the machine when the application is running, the Android Studio log is sending me this:

Quote
03-22 17:03:20.982 2711-2718/com.mygames.apptest W/art: Suspending all threads took: 12.245ms
03-22 17:03:26.907 2711-2718/com.mygames.apptest W/art: Suspending all threads took: 6.843ms
03-22 17:04:55.565 2711-2718/com.mygames.apptest W/art: Suspending all threads took: 73.474ms
03-22 17:04:55.747 2711-3538/com.mygames.apptest E/Surface: getSlotFromBufferLocked: unknown buffer: 0xac0b0fc0
03-22 17:04:56.798 2711-4874/com.mygames.apptest E/eglCodecCommon: glUtilsParamSize: unknow param 0x0000821b
03-22 17:04:56.811 2711-4874/com.mygames.apptest E/eglCodecCommon: glUtilsParamSize: unknow param 0x0000821c
03-22 17:04:56.823 2711-4874/com.mygames.apptest E/eglCodecCommon: glUtilsParamSize: unknow param 0x0000821e
03-22 17:04:56.827 2711-4874/com.mygames.apptest E/eglCodecCommon: glUtilsParamSize: unknow param 0x00009126
03-22 17:04:56.831 2711-4874/com.mygames.apptest E/eglCodecCommon: glUtilsParamSize: unknow param 0x0000821b
03-22 17:04:56.887 2711-4874/com.mygames.apptest E/libEGL: call to OpenGL ES API with no current context (logged once per thread)

I hope this information can help you
« Last Edit: April 03, 2018, 07:49:19 pm by IsD »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: [Android] Crash when paused
« Reply #7 on: March 22, 2018, 08:47:07 pm »
SFML's context handling on OpenGL ES platforms is still in its infancy. When you switch away from an application (or cause the system to go into a power saving mode) on Android or any other mobile platform, the system is allowed to destroy any active OpenGL ES contexts that have been created. This is mainly to save/share the limited system resources more efficiently. A robust OpenGL ES application would have to be able to deal with context loss if it happens. Currently, there is no way for this to be handled elegantly in SFML.

Someone with more experience developing for Android might know of a workaround to prevent context loss so that SFML would not have to deal with this situation. Something along the lines of setPreserveEGLContextOnPause.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

 

anything