Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.82k stars 821 forks source link

iOS app crashes when brought to foreground #1050

Closed PippoApps closed 5 years ago

PippoApps commented 5 years ago

Hello folks, On iOS app works fine, can be used over and over with stable memory and great performance. BUT if I play a video using Texture.fromNetStream(), or I do any other intense activity, even though the video has finished playing, texture disposed, NetStream and NetConnection closed and disposed, bringing the app back to foreground makes it crash. Doesn't matter how long earlier I played the video, app still crashes. Even just after navigating a few sections, going back to foreground makes it crash. Consistently with: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000 Any idea? Cheers

PrimaryFeather commented 5 years ago

Does it happen only with the video, or even without? (As you wrote 'any other intense activity'.) Are you using any ANEs?

PippoApps commented 5 years ago

No ANEs. I managed to narrow this to a very simple test. Tried with AIR 27, 31 and 32 on both iOS 9 and 12. It is a NetStream problem, not related to Starling. Consistently, if a new NetStream is referenced, on iOS app crashes once brought to foreground again. Basically:

private var _ns:NetStream; // This is of course in class constructor
var c:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream();
// All fine so far, just add next line:
_ns = ns; // This creates the crash. If this is omitted, no crash.

You can imagine how long it took me to narrow this down :D

I have created an app with just this, and the crash happens consistently. On both Apple devices, compiling on different machines. Comment _ns = ns, and it doesn't crash. Preatty weird right?

It is something related to reference not kept when the app is restored. Infact the error seems to be a null pointer reference.

If you want to give it a go, source code for the app is here (it's only a main class with about 10 lines of code, including creation of an output textfield): https://drive.google.com/open?id=1s92-Wv99dechTZgqRxNMpf-C1SabxBNh

Actually would be great if someone else tested this. I filed a bug also on Gamua's and Adobe's tracker.

https://tracker.adobe.com/#/view/AIR-4198784

PrimaryFeather commented 5 years ago

I can reproduce the problem!

You can imagine how long it took me to narrow this down :D

Oh yeah, I can imagine ...! Thanks a lot for biting the bullet and getting to the root of this! Let's hope Adobe can fix it quickly.

PrimaryFeather commented 5 years ago

Since Adobe apparently fixed this, I'll close this issue! Thanks to everyone involved.