Steps to reproduce:
Player will crash while transitioning back to the map. This isn't from a recent pull; existed at 6467db2 (picked at random) for example.
Backtrace looks like
#0 0x0000000000000000 in ?? ()
#1 0x000000000093b66c in Graphics::SnapToBitmap() ()
#2 0x000000000093b758 in Graphics::Freeze() ()
#3 0x000000000093b8ce in Graphics::Transition(Graphics::TransitionType, int, bool) ()
#4 0x0000000000900862 in Scene_Map::TransitionIn() ()
#5 0x000000000090f76e in Scene::MainFunction() ()
#6 0x0000000000822c18 in Player::MainLoop() ()
#7 0x0000000000822a85 in Player::Run() ()
#8 0x0000000000821331 in main ()
Excellent! You found the random crash reason in OFF :D
play a battle animation on the map
Great catch, i had no Idea why it was happening only sometimes 👍 .
Same as #564 (but that one is closed but not fixed there yet :\ ). Let's use the current one instead of closing and reopening because now is triaged.
Arg, think I got it. There's a stack of lists of Drawables, matching the stack of Scenes, right? But Game_Screen is global. So by the time an animation that plays in battle evicts Game_Screen's shared pointer holding the animation from the map, destroying the animation and calling the function to remove it from the list, a different list is on top of the stack! When the battle scene pops off, the dangling pointer is still on the list for the map, and dereferencing it kills the program.
So just reseting Game_Screen::animation before calling the battle will fix it. But how about splitting it up into two animation pointers, one in Game_Map and one in Game_Battle? I don't really see why it should belong to Game_Screen anyway.
There is no BattleAnimation code shared between Battle or Map in game_interpreter.cpp, therefore splitting looks save.