Skip to content
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

Crash at the SDL_EGL_MakeCurrent() call on Android 5.1 #4040

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 2 comments
Closed

Crash at the SDL_EGL_MakeCurrent() call on Android 5.1 #4040

SDLBugzilla opened this issue Feb 11, 2021 · 2 comments

Comments

@SDLBugzilla
Copy link
Collaborator

SDLBugzilla commented Feb 11, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 2.0.14
Reported for operating system, platform: Android (All), ARM

Comments on the original bug report:

On 2021-02-02 21:06:54 +0000, Vitaly Novichkov wrote:

Created attachment 4749
Screenshot of the crash moment

On Android 5 I found the next case:

  • Having a separated "launcher" activity
  • Starting the SDL-based activity by button press and then .finish() the "launcher" activity
  • It starts normally and works normally
  • Using SDL Renderer API with the accelerated context
  • Inside of onDestroy() at my class, call the System.exit(0);
  • Starting the app again
  • Pressing the start button at the "launcher" activity
  • Attempt to initialize the context causes the SIGSEGV crash at the SDL_EGL_MakeCurrent()
  • All the test was done on the Archos c70 Xenon tablet with Android 5.1.

I had attached the screenshot of the problem. I do use the SDL 2.0.14 release. I had to check HG for any OpenGL ES related commits and seems nothing was found interesting.

Gonna try to run this at the emulator, will it be reproduced the same or not?

On 2021-02-02 21:14:26 +0000, Vitaly Novichkov wrote:

Created attachment 4750
Detailed variables 1 and stack trace for the crash moment

On 2021-02-02 21:14:52 +0000, Vitaly Novichkov wrote:

Created attachment 4751
Detailed variables 2

On 2021-02-03 07:19:46 +0000, Sylvain wrote:

Do you have

android:launchMode="singleInstance"

in you AndroidManifest.xml for your activities ?

On 2021-02-03 07:55:56 +0000, Vitaly Novichkov wrote:

(In reply to Sylvain from comment # 3)

Do you have

android:launchMode="singleInstance"

in you AndroidManifest.xml for your activities ?

It's done for only one activity - the SDL-based one, do you suggest me to make it on both launcher and SDL-based? Gonna try...

On 2021-02-03 08:54:55 +0000, Vitaly Novichkov wrote:

android:launchMode="singleInstance"

Didn't helped


Okay, I may guess that the reason for this because when I close the application and doing clean-up, I do:

  • SDL_HideWindow(window) //
  • SDL_SetWindowFullscreen(window, SDL_FALSE) // on Android game is always full-screen
  • SDL_SetWindowSize() // restoring original size of the window

And during the startup:

  • SDL_CreateWindow
  • SDL_SetWindowMinimumSize
  • SDL_SetWindowFullscreen(m_window, SDL_WINDOW_FULLSCREEN_DESKTOP)
  • SDL_PollEvents while window is still hidden
  • Attempt to load any graphics causes the crash:
    -- SDL_CreateRGBSurfaceFrom
    -- SDL_CreateTextureFromSurface
    -- SDL_FreeSurface
    or at an attempt to poll events at some moment, etc.

On 2021-02-03 09:17:03 +0000, Vitaly Novichkov wrote:

Okay, seems the issue has gone when I do a show of the window after I created it. If I do textures loading while the window is hidden, it will crash on startup.

On 2021-02-03 09:17:59 +0000, Vitaly Novichkov wrote:

Also, when closing the application, don't hide the window until destroy all textures.

On 2021-02-03 09:27:27 +0000, Vitaly Novichkov wrote:

Oh! One thing I just now reminded! Before I made the launcher activity, the game worked perfectly and started with no crashes. The crash got introduced once I started to use the launcher activity. I do call next:

    Intent myIntent = new Intent(Launcher.this, thextechActivity.class);
    Launcher.this.startActivity(myIntent);
    Launcher.this.finish();

to start it. Should I also specify some to make sure the "single instance" works?

On 2021-02-03 12:46:34 +0000, Sylvain wrote:

you may also use android:alwaysRetainTaskState="true"

to make sure single instance works,
maybe add static int variable in you activity class,
log it and increment it in onCreate()
it should remains at 0 each time.

(don't do anything, in one destroy because it may be never called)

check maybe if the C code is also not loaded more than once ?

On 2021-02-03 22:12:43 +0000, Vitaly Novichkov wrote:

you may also use android:alwaysRetainTaskState="true"

That's already at my SDL-based activity

to make sure single instance works,
maybe add static int variable in you activity class,
log it and increment it in onCreate()
it should remains at 0 each time.

I'll try this to check...

check maybe if the C code is also not loaded more than once?

That right, because the crash happens at C code side

@Wohlstand
Copy link
Contributor

I gonna finish this on my side as fast as possible. I'll subscribe here to all bugs I made at Bugzilla in the past until it will be lost.

@Wohlstand
Copy link
Contributor

Okay, seems this bug got been resolved once I refactored my game side renderer to fix this #4041, but also I got fixed this too. @sezero, could you help me to close this issue?

@slouken slouken closed this as completed Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants