[Scummvm-cvs-logs] SF.net SVN: scummvm: [32519] scummvm/branches/gsoc2008-rtl/engines/ parallaction

cpage88 at users.sourceforge.net cpage88 at users.sourceforge.net
Tue Jun 3 20:24:54 CEST 2008


Revision: 32519
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32519&view=rev
Author:   cpage88
Date:     2008-06-03 11:24:54 -0700 (Tue, 03 Jun 2008)

Log Message:
-----------
PARA: Fixed some memory leaks

Modified Paths:
--------------
    scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction.cpp
    scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction.h
    scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction_ns.cpp
    scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.cpp
    scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.h
    scummvm/branches/gsoc2008-rtl/engines/parallaction/parser_ns.cpp

Modified: scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction.cpp	2008-06-03 18:17:56 UTC (rev 32518)
+++ scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction.cpp	2008-06-03 18:24:54 UTC (rev 32519)
@@ -84,18 +84,18 @@
 
 
 Parallaction::~Parallaction() {
+	clearSet(_commandOpcodes);
+	clearSet(_instructionOpcodes);
+	
 	delete _debugger;
-
 	delete _globalTable;
-
 	delete _callableNames;
-	//delete _localFlagNames;
 
 	freeLocation();
 
 	freeCharacter();
 	destroyInventory();
-
+	
 	delete _localFlagNames;
 	delete _gfx;
 	delete _soundMan;
@@ -138,11 +138,13 @@
 }
 
 
+void Parallaction::clearSet(OpcodeSet &opcodes) {
+	for (Common::Array<const Opcode*>::iterator i = opcodes.begin(); i != opcodes.end(); ++i)
+		delete *i;
+	opcodes.clear();
+}
 
 
-
-
-
 void Parallaction::updateView() {
 
 	if ((_engineFlags & kEnginePauseJobs) && (_engineFlags & kEngineInventory) == 0) {
@@ -534,10 +536,10 @@
 	delete _objs;
 	delete _ani->gfxobj;
 
-	_ani->gfxobj = NULL;
 	_talk = NULL;
 	_head = NULL;
 	_objs = NULL;
+	_ani->gfxobj = NULL;
 
 	return;
 }

Modified: scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction.h	2008-06-03 18:17:56 UTC (rev 32518)
+++ scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction.h	2008-06-03 18:24:54 UTC (rev 32519)
@@ -385,6 +385,9 @@
 
 	int16		pickupItem(ZonePtr z);
 
+	void 		clearSet(OpcodeSet &opcodes);
+
+
 public:
 	virtual	void callFunction(uint index, void* parm) { }
 
@@ -401,6 +404,7 @@
 
 	void		beep();
 
+
 public:
 //	const char **_zoneFlagNamesRes;
 //	const char **_zoneTypeNamesRes;

Modified: scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction_ns.cpp	2008-06-03 18:17:56 UTC (rev 32518)
+++ scummvm/branches/gsoc2008-rtl/engines/parallaction/parallaction_ns.cpp	2008-06-03 18:24:54 UTC (rev 32519)
@@ -154,7 +154,9 @@
 
 Parallaction_ns::~Parallaction_ns() {
 	freeFonts();
-
+	
+	delete _locationParser;
+	delete _programParser;
 	delete _mouseComposedArrow;
 
 	_location._animations.remove(_char._ani);

Modified: scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.cpp	2008-06-03 18:17:56 UTC (rev 32518)
+++ scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.cpp	2008-06-03 18:24:54 UTC (rev 32519)
@@ -30,11 +30,8 @@
 
 char			_tokens[20][MAX_TOKEN_LEN];
 
-Script::Script(Common::ReadStream *input, bool disposeSource) : _input(input), _disposeSource(disposeSource), _line(0) {
+Script::Script(Common::ReadStream *input, bool disposeSource) : _input(input), _disposeSource(disposeSource), _line(0) {}
 
-//	clearAllTokens();
-}
-
 Script::~Script() {
 	if (_disposeSource)
 		delete _input;
@@ -75,17 +72,6 @@
 
 }
 
-/*
-void Script::clearAllTokens() {
-
-	for (uint16 i = 0; i < 20; i++)
-		for (uint16 j = 0; j < 50; j++)
-			_tokens[i][j] = '\0';
-	
-	return;
-}
-*/
-
 void Script::skip(const char* endToken) {
 
 	while (scumm_stricmp(_tokens[0], endToken)) {

Modified: scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.h	2008-06-03 18:17:56 UTC (rev 32518)
+++ scummvm/branches/gsoc2008-rtl/engines/parallaction/parser.h	2008-06-03 18:24:54 UTC (rev 32519)
@@ -44,7 +44,6 @@
 	uint	_line;				// for debug messages
 
 	void clearTokens();
-	//void clearAllTokens();
 	uint16 fillTokens(char* line);
 
 public:
@@ -222,7 +221,6 @@
 
 	virtual ~LocationParser_ns() {
 		delete _parser;
-		delete _script;
 		delete _commandsNames;
 		delete _locationStmt;
 		delete _locationZoneStmt;
@@ -230,8 +228,6 @@
 		delete _zoneTypeNames;
 		delete _zoneFlagNames;
 
-		delete _parser;
-
 		clearSet(_commandParsers);
 		clearSet(_locationAnimParsers);
 		clearSet(_locationZoneParsers);
@@ -361,7 +357,9 @@
 	}
 
 	virtual ~ProgramParser_ns() {
+		delete _parser;
 		delete _instructionNames;
+
 		clearSet(_instructionParsers);
 	}
 

Modified: scummvm/branches/gsoc2008-rtl/engines/parallaction/parser_ns.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/parallaction/parser_ns.cpp	2008-06-03 18:17:56 UTC (rev 32518)
+++ scummvm/branches/gsoc2008-rtl/engines/parallaction/parser_ns.cpp	2008-06-03 18:24:54 UTC (rev 32519)
@@ -1396,7 +1396,7 @@
 	list.push_front(z);
 
 	_parser->pushTables(&_locationZoneParsers, _locationZoneStmt);
-
+	
 	return;
 }
 


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