[Scummvm-cvs-logs] SF.net SVN: scummvm:[38893] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Thu Feb 26 10:12:30 CET 2009


Revision: 38893
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38893&view=rev
Author:   peres001
Date:     2009-02-26 09:12:29 +0000 (Thu, 26 Feb 2009)

Log Message:
-----------
Fixed crashes and leaks when quitting BRA from menu and splash screen.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/balloons.cpp
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/gui_br.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction_br.cpp

Modified: scummvm/trunk/engines/parallaction/balloons.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/balloons.cpp	2009-02-26 06:16:35 UTC (rev 38892)
+++ scummvm/trunk/engines/parallaction/balloons.cpp	2009-02-26 09:12:29 UTC (rev 38893)
@@ -753,6 +753,8 @@
 }
 
 void Parallaction::setupBalloonManager() {
+    _balloonMan = 0;
+
 	if (getGameType() == GType_Nippon) {
 		_balloonMan = new BalloonManager_ns(_gfx, _dialogueFont);
 	} else

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2009-02-26 06:16:35 UTC (rev 38892)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2009-02-26 09:12:29 UTC (rev 38893)
@@ -769,7 +769,7 @@
 void Gfx::freeDialogueObjects() {
 	_items.clear();
 
-	_vm->_balloonMan->reset();
+    _vm->_balloonMan->reset();
 
 	for (uint i = 0; i < _balloons.size(); i++) {
 		delete _balloons[i];

Modified: scummvm/trunk/engines/parallaction/gui_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gui_br.cpp	2009-02-26 06:16:35 UTC (rev 38892)
+++ scummvm/trunk/engines/parallaction/gui_br.cpp	2009-02-26 09:12:29 UTC (rev 38893)
@@ -159,11 +159,11 @@
 	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 @@
 
 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;
 		}

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2009-02-26 06:16:35 UTC (rev 38892)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2009-02-26 09:12:29 UTC (rev 38893)
@@ -86,14 +86,15 @@
 	delete _programExec;
 	delete _saveLoad;
 
+	cleanupGui();
+
 	_gfx->freeCharacterObjects();
 	_gfx->freeLocationObjects();
 	delete _balloonMan;
+	_balloonMan = 0;
 
 	destroyInventory();
 
-	cleanupGui();
-
 	delete _localFlagNames;
 	delete _gfx;
 	delete _soundMan;

Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp	2009-02-26 06:16:35 UTC (rev 38892)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp	2009-02-26 09:12:29 UTC (rev 38893)
@@ -100,9 +100,13 @@
 	freeFonts();
 	freeCharacter();
 
+	delete _objects;
+
 	delete _locationParser;
 	delete _programParser;
 
+	_location._animations.remove(_char._ani);
+
 	delete _walker;
 }
 
@@ -141,15 +145,15 @@
 }
 
 
-
 void Parallaction_br::freeFonts() {
 	delete _menuFont;
+	_menuFont  = 0;
+
 	delete _dialogueFont;
+	_dialogueFont = 0;
 
-	_menuFont  = 0;
-	_dialogueFont = 0;
+	// no need to delete _labelFont, since it is using the same buffer as _menuFont
 	_labelFont = 0;
-	_introFont = 0;
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list