Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed the crash happening when quitting the game during a transition …

…to battle.

While digging around something I'll push in the next commits,
I found that the BattleMode singleton instance was set in the reset() function
leading to the fact that when it was freed before being initialized and reset,
the finish supervisor would make the game crash due to calls to that instance.

I made sure the transition to battle would free the battle mode if it was destructed
before passing to the game mode manager and fixed that crash by setting the instance
in the battle mode constructor, as no more than one battle at a time will happen anyway.

Sorry Ikarus, I know you wanted this one but since I saw it, I fixed it.
Hope you don't mind ;)
  • Loading branch information...
commit cc9818f0ad6fb53347a67f38ed43fc5369cee597 1 parent 8371853
Yohann Ferreira authored
Showing with 8 additions and 4 deletions.
  1. +2 −2 src/modes/battle/battle.cpp
  2. +6 −2 src/modes/battle/battle.h
View
4 src/modes/battle/battle.cpp
@@ -280,6 +280,8 @@ BattleMode::BattleMode() :
mode_type = MODE_MANAGER_BATTLE_MODE;
+ _current_instance = this;
+
_sequence_supervisor = new SequenceSupervisor(this);
_command_supervisor = new CommandSupervisor();
_dialogue_supervisor = new DialogueSupervisor();
@@ -319,8 +321,6 @@ BattleMode::~BattleMode()
void BattleMode::Reset()
{
- _current_instance = this;
-
VideoManager->SetStandardCoordSys();
// Load the default battle music track if no other music has been added
View
8 src/modes/battle/battle.h
@@ -624,8 +624,12 @@ class TransitionToBattleMode : public hoa_mode_manager::GameMode
public:
TransitionToBattleMode(BattleMode *BM);
- ~TransitionToBattleMode()
- {}
+ ~TransitionToBattleMode() {
+ // If the game quits while in pause mode during a transition to battle,
+ // The battle mode object needs to be freed.
+ if (_BM)
+ delete _BM;
+ }
void Update();
Please sign in to comment.
Something went wrong with that request. Please try again.