Crash when returning from battle to map where animation is playing #580

scurest opened this Issue Sep 7, 2015 · 4 comments


None yet

3 participants

scurest commented Sep 7, 2015

Steps to reproduce:

  1. play a battle animation on the map
  2. enter a battle while it is ongoing
  3. exit the battle

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 ()
Ghabry commented Sep 7, 2015

Excellent! You found the random crash reason in OFF :D


  1. 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.

@Ghabry Ghabry added the Crash label Sep 7, 2015
scurest commented Sep 8, 2015

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.

Ghabry commented Sep 8, 2015

There is no BattleAnimation code shared between Battle or Map in game_interpreter.cpp, therefore splitting looks save.

@Ghabry Ghabry modified the milestone: 0.3.2 Sep 8, 2015
@Ghabry Ghabry pushed a commit that closed this issue Sep 13, 2015
@scurest scurest Fix #580 c320325
@Ghabry Ghabry closed this in c320325 Sep 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment