I have been investigating an issue causing segfaults on Linux when all of these conditions are met:
- There is a Tilemap which has previously contained Tiles
- The Tiles have all been removed from the Tilemap and it has been empty for somewhere between minutes and hours (five minutes doesn’t always lead to the crash, overnight does seem to)
- A new Tile is added to this Tilemap
The crash appears to occur outside the code written for the project - the Tile is added successfully, the code can then go on to do other things, but some time after control is passed back to the rest of the OpenFL system, it segfaults. I’m assuming it’s connected with the operation to draw this newly added Tile on the Tilemap, but I haven’t investigated that deeply.
I’ve only seen it happen natively on Linux - running in Neko does not cause the crash, and so far my tests on Android have not produced the crash. I don’t yet have a Windows system or any others to test on so I don’t know which other systems might be affected.
I’ve made a modified version of the BunnyMark demo which allows the Bunny tiles to be removed as they hop off the edge of the screen, to demonstrate the issue and document how it is reproduced. Hardware and software details are included in that page, copied here for convenience:
- AMD Desktop with nvidia graphics card and Intel laptop with Intel on-board graphics
- Linux kernel versions 4.15.9-1-ARCH and 4.15.3-2-ARCH
- Haxe compiler versions 3.4.7 and 3.4.4
- hxcpp version 3.4.188
- lime versions 6.2.0 and 5.9.1
- openfl versions 7.1.2 and 6.5.3
As mentioned in that repo, it’s easy enough to work around the issue: simply add a Tile to every Tilemap with co-ordinates which place it out of sight, and leave it there for the life of the Tilemap. With this workaround in place I’m going to move on with my project, but I wanted to document and report the issue first.