Fixed crashes and leaks when quitting BRA from menu and splash screen.

svn-id: r38893
This commit is contained in:
Nicola Mettifogo
2009-02-26 09:12:29 +00:00
parent d5d006bb30
commit 3efffe511b
5 changed files with 23 additions and 10 deletions
+2
View File
@@ -753,6 +753,8 @@ BalloonManager_br::~BalloonManager_br() {
}
void Parallaction::setupBalloonManager() {
_balloonMan = 0;
if (getGameType() == GType_Nippon) {
_balloonMan = new BalloonManager_ns(_gfx, _dialogueFont);
} else
+1 -1
View File
@@ -769,7 +769,7 @@ GfxObj* Gfx::registerBalloon(Frames *frames, const char *text) {
void Gfx::freeDialogueObjects() {
_items.clear();
_vm->_balloonMan->reset();
_vm->_balloonMan->reset();
for (uint i = 0; i < _balloons.size(); i++) {
delete _balloons[i];
+9 -3
View File
@@ -159,11 +159,11 @@ class MainMenuInputState_BR : public MenuInputState {
int _selection;
void cleanup() {
_vm->_system->showMouse(false);
_vm->_gfx->freeDialogueObjects();
_vm->_gfx->freeDialogueObjects();
for (int i = 0; i < _availItems; i++) {
delete _lines[i];
_lines[i] = 0;
}
}
@@ -185,13 +185,19 @@ class MainMenuInputState_BR : public MenuInputState {
public:
MainMenuInputState_BR(Parallaction_br *vm, MenuInputHelper *helper) : MenuInputState("mainmenu", helper), _vm(vm) {
memset(_lines, 0, sizeof(_lines));
}
~MainMenuInputState_BR() {
cleanup();
}
virtual MenuInputState* run() {
int event = _vm->_input->getLastButtonEvent();
if ((event == kMouseLeftUp) && _selection >= 0) {
cleanup();
_vm->_system->showMouse(false);
cleanup();
performChoice(_options[_selection]);
return 0;
}
+3 -2
View File
@@ -86,14 +86,15 @@ Parallaction::~Parallaction() {
delete _programExec;
delete _saveLoad;
cleanupGui();
_gfx->freeCharacterObjects();
_gfx->freeLocationObjects();
delete _balloonMan;
_balloonMan = 0;
destroyInventory();
cleanupGui();
delete _localFlagNames;
delete _gfx;
delete _soundMan;
+8 -4
View File
@@ -100,9 +100,13 @@ Parallaction_br::~Parallaction_br() {
freeFonts();
freeCharacter();
delete _objects;
delete _locationParser;
delete _programParser;
_location._animations.remove(_char._ani);
delete _walker;
}
@@ -141,15 +145,15 @@ Common::Error Parallaction_br::go() {
}
void Parallaction_br::freeFonts() {
delete _menuFont;
delete _dialogueFont;
_menuFont = 0;
delete _dialogueFont;
_dialogueFont = 0;
// no need to delete _labelFont, since it is using the same buffer as _menuFont
_labelFont = 0;
_introFont = 0;
}