flixel icon indicating copy to clipboard operation
flixel copied to clipboard

`FlxAtlasFrames`'s function `addAtlas()` may crash the game

Open Cheemsandfriends opened this issue 1 year ago • 5 comments

When using addAtlas() on a Frames and then clear the cache of the images, there is a chance that the graphics that its frames are nested to other frames are selected first, making it so the graphic doesnt get destroyed, but the main one gets destroyed.

This causes that the graphic is on the cache, even though the bitmap is destroyed, causing the game to basically crash.

Cheemsandfriends avatar Dec 22 '23 23:12 Cheemsandfriends

do you have a simple repro?

Geokureli avatar Dec 23 '23 00:12 Geokureli

I can give you the test bench that @EliteMasterEric gave to me regarding to this issue

https://github.com/EliteMasterEric/FlxAnimate-TestBench

I know it should be using a normal flixel project, but this one is the quickest I can give you if you need another one that doesnt involve this one, tell me and ill make one myself lol

Cheemsandfriends avatar Dec 23 '23 02:12 Cheemsandfriends

Is there a specific thing thing i need to do to cause it to happen or is it ser up to happen right away

Geokureli avatar Dec 23 '23 02:12 Geokureli

Is there a specific thing thing i need to do to cause it to happen or is it ser up to happen right away

The specific steps that reliably reproduce it are pressing 121312 (pressing different numbers switches to different FlxStates)

I believe the general reproduction is moving to the state containing the sprite, leaving and transitioning states some more to ensure the graphic is destroyed, then returning back. Moving away from the state and then directly back doesn't reproduce the issue.

EliteMasterEric avatar Dec 23 '23 05:12 EliteMasterEric

thanks for the steps I'll check this out after the weekend

Geokureli avatar Dec 23 '23 14:12 Geokureli