Android - Crash with Listener EVENT_COME_TO_FOREGROUND and adding new ui::Widget #2386
Replies: 2 comments 2 replies
-
Just out of curiosity, does it also work if a delay of
or
Strange things seem to happen in event handlers depending on what code you run in them. I just checked my own project, and noticed that I use the |
Beta Was this translation helpful? Give feedback.
-
That would happen if the EGL context is lost, so you would need to handle that scenario. If you want to verify if it is the cause of the crashes, then add a listener for the |
Beta Was this translation helpful? Give feedback.
-
Hi!
I'm facing a strange bug and wanted to ask here if someone has faced it too, if it is expected because of how axmol is made or not as I'm not an expert.
What I do:
In the current scene I add a listener for
EVENT_COME_TO_FOREGROUND
and in it, I create aui::Widget
and add it to the scene.On the UI I put a button that opens a link using
Application::getInstance()->openURL("https://google.com");
and this causes the app to go to background.When coming back on the app or using the back button, on some devices, it will crash. I suspect crashing or not depends if the java open gl/rendering is running and ready or not.
For example, on a Pixel 6 it is working without issue, but on a Samsung Tab S8 it will crash.
As side note I know Samsung mess up with activities and context after first launch depending how the app is started (see https://stackoverflow.com/questions/19545889/app-restarts-rather-than-resumes/23220151#23220151)
The solution is to delay the add by 0.1 second:
I'm pretty sure this issue has created many crashes with different strange stacks for few years already.
Beta Was this translation helpful? Give feedback.
All reactions