[Scummvm-cvs-logs] SF.net SVN: scummvm:[35355] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sun Dec 14 05:33:28 CET 2008


Revision: 35355
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35355&view=rev
Author:   drmccoy
Date:     2008-12-14 04:33:28 +0000 (Sun, 14 Dec 2008)

Log Message:
-----------
Plugging leaks

Modified Paths:
--------------
    scummvm/trunk/engines/gob/draw.cpp
    scummvm/trunk/engines/gob/draw.h
    scummvm/trunk/engines/gob/init.cpp
    scummvm/trunk/engines/gob/inter_v1.cpp
    scummvm/trunk/engines/gob/inter_v5.cpp
    scummvm/trunk/engines/gob/util.cpp
    scummvm/trunk/engines/gob/util.h
    scummvm/trunk/engines/gob/video.cpp
    scummvm/trunk/engines/gob/video.h
    scummvm/trunk/engines/gob/video_v6.cpp

Modified: scummvm/trunk/engines/gob/draw.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw.cpp	2008-12-14 04:24:41 UTC (rev 35354)
+++ scummvm/trunk/engines/gob/draw.cpp	2008-12-14 04:33:28 UTC (rev 35355)
@@ -134,6 +134,11 @@
 	_scrollOffsetY = 0;
 }
 
+Draw::~Draw() {
+	for (int i = 0; i < 8; i++)
+		delete _fonts[i];
+}
+
 void Draw::invalidateRect(int16 left, int16 top, int16 right, int16 bottom) {
 	if (_renderFlags & RENDERFLAG_NOINVALIDATE) {
 		_vm->_video->dirtyRectsAll();

Modified: scummvm/trunk/engines/gob/draw.h
===================================================================
--- scummvm/trunk/engines/gob/draw.h	2008-12-14 04:24:41 UTC (rev 35354)
+++ scummvm/trunk/engines/gob/draw.h	2008-12-14 04:33:28 UTC (rev 35355)
@@ -168,7 +168,7 @@
 	virtual void spriteOperation(int16 operation) = 0;
 
 	Draw(GobEngine *vm);
-	virtual ~Draw() {}
+	virtual ~Draw();
 
 protected:
 	GobEngine *_vm;

Modified: scummvm/trunk/engines/gob/init.cpp
===================================================================
--- scummvm/trunk/engines/gob/init.cpp	2008-12-14 04:24:41 UTC (rev 35354)
+++ scummvm/trunk/engines/gob/init.cpp	2008-12-14 04:33:28 UTC (rev 35355)
@@ -209,11 +209,6 @@
 
 	}
 
-	for (int i = 0; i < 4; i++) {
-		if (_vm->_draw->_fonts[i] != 0)
-			_vm->_util->freeFont(_vm->_draw->_fonts[i]);
-	}
-
 	delete _palDesc;
 	_vm->_dataIO->closeDataFile();
 	_vm->_video->initPrimary(-1);

Modified: scummvm/trunk/engines/gob/inter_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v1.cpp	2008-12-14 04:24:41 UTC (rev 35354)
+++ scummvm/trunk/engines/gob/inter_v1.cpp	2008-12-14 04:33:28 UTC (rev 35355)
@@ -2170,8 +2170,7 @@
 	evalExpr(0);
 	index = load16();
 
-	if (_vm->_draw->_fonts[index])
-		_vm->_util->freeFont(_vm->_draw->_fonts[index]);
+	delete _vm->_draw->_fonts[index];
 
 	_vm->_draw->animateCursor(4);
 	if (_vm->_game->_extHandle >= 0)
@@ -2189,9 +2188,7 @@
 	int16 index;
 
 	index = load16();
-	if (_vm->_draw->_fonts[index])
-		_vm->_util->freeFont(_vm->_draw->_fonts[index]);
-
+	delete _vm->_draw->_fonts[index];
 	_vm->_draw->_fonts[index] = 0;
 	return false;
 }

Modified: scummvm/trunk/engines/gob/inter_v5.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v5.cpp	2008-12-14 04:24:41 UTC (rev 35354)
+++ scummvm/trunk/engines/gob/inter_v5.cpp	2008-12-14 04:33:28 UTC (rev 35355)
@@ -852,7 +852,7 @@
 		_vm->_draw->drawString("100 %", 402, 89, 112, 144, 0, _vm->_draw->_backSurface, font);
 		_vm->_draw->forceBlit();
 
-		_vm->_util->freeFont(font);
+		delete font;
 	}
 }
 
@@ -866,7 +866,7 @@
 		_vm->_draw->drawString("100 %", 402, 168, 112, 144, 0, _vm->_draw->_backSurface, font);
 		_vm->_draw->forceBlit();
 
-		_vm->_util->freeFont(font);
+		delete font;
 	}
 }
 
@@ -880,7 +880,7 @@
 		_vm->_draw->drawString("100 %", 402, 248, 112, 144, 0, _vm->_draw->_backSurface, font);
 		_vm->_draw->forceBlit();
 
-		_vm->_util->freeFont(font);
+		delete font;
 	}
 }
 
@@ -894,7 +894,7 @@
 		_vm->_draw->drawString("100 %", 402, 326, 112, 144, 0, _vm->_draw->_backSurface, font);
 		_vm->_draw->forceBlit();
 
-		_vm->_util->freeFont(font);
+		delete font;
 	}
 }
 
@@ -908,7 +908,7 @@
 		_vm->_draw->drawString("100 %", 402, 405, 112, 144, 0, _vm->_draw->_backSurface, font);
 		_vm->_draw->forceBlit();
 
-		_vm->_util->freeFont(font);
+		delete font;
 	}
 }
 

Modified: scummvm/trunk/engines/gob/util.cpp
===================================================================
--- scummvm/trunk/engines/gob/util.cpp	2008-12-14 04:24:41 UTC (rev 35354)
+++ scummvm/trunk/engines/gob/util.cpp	2008-12-14 04:33:28 UTC (rev 35355)
@@ -378,11 +378,6 @@
 	return fontDesc;
 }
 
-void Util::freeFont(Video::FontDesc *fontDesc) {
-	delete[] (fontDesc->dataPtr - 4);
-	delete fontDesc;
-}
-
 void Util::insertStr(const char *str1, char *str2, int16 pos) {
 	int len1 = strlen(str1);
 	int len2 = strlen(str2);

Modified: scummvm/trunk/engines/gob/util.h
===================================================================
--- scummvm/trunk/engines/gob/util.h	2008-12-14 04:24:41 UTC (rev 35354)
+++ scummvm/trunk/engines/gob/util.h	2008-12-14 04:33:28 UTC (rev 35355)
@@ -77,7 +77,6 @@
 	void setScrollOffset(int16 x = -1, int16 y = -1);
 
 	Video::FontDesc *loadFont(const char *path);
-	void freeFont(Video::FontDesc *fontDesc);
 
 	static void insertStr(const char *str1, char *str2, int16 pos);
 	static void cutFromStr(char *str, int16 from, int16 cutlen);

Modified: scummvm/trunk/engines/gob/video.cpp
===================================================================
--- scummvm/trunk/engines/gob/video.cpp	2008-12-14 04:24:41 UTC (rev 35354)
+++ scummvm/trunk/engines/gob/video.cpp	2008-12-14 04:33:28 UTC (rev 35355)
@@ -120,6 +120,10 @@
 	return 1;
 }
 
+Video::~Video() {
+	delete _palLUT;
+}
+
 void Video::freeDriver() {
 	delete _videoDriver;
 }

Modified: scummvm/trunk/engines/gob/video.h
===================================================================
--- scummvm/trunk/engines/gob/video.h	2008-12-14 04:24:41 UTC (rev 35354)
+++ scummvm/trunk/engines/gob/video.h	2008-12-14 04:33:28 UTC (rev 35355)
@@ -75,7 +75,11 @@
 		int8 bitWidth;
 		byte *extraData;
 		FontDesc() : dataPtr(0), itemWidth(0), itemHeight(0), startItem(0),
-			               endItem(0), itemSize(0), bitWidth(0) {}
+		             endItem(0), itemSize(0), bitWidth(0) {}
+		~FontDesc() {
+			if (dataPtr)
+				delete[] (dataPtr - 4);
+		}
 	};
 
 #define GDR_VERSION	4
@@ -177,7 +181,7 @@
 	virtual void init() { }
 
 	Video(class GobEngine *vm);
-	virtual ~Video() {}
+	virtual ~Video();
 
 protected:
 	class VideoDriver *_videoDriver;

Modified: scummvm/trunk/engines/gob/video_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/video_v6.cpp	2008-12-14 04:24:41 UTC (rev 35354)
+++ scummvm/trunk/engines/gob/video_v6.cpp	2008-12-14 04:33:28 UTC (rev 35355)
@@ -27,6 +27,7 @@
 
 #include "gob/gob.h"
 #include "gob/video.h"
+#include "gob/util.h"
 #include "gob/indeo3.h"
 
 namespace Gob {
@@ -40,10 +41,11 @@
 	initOSD();
 
 	char text[30];
-	for (int i = 0; i < 64; i++) {
+	for (int i = 0; (i < 64) && !_vm->shouldQuit(); i++) {
 		sprintf(text, "Building palette table: %02d/63", i);
 		drawOSDText(text);
 		_palLUT->buildNext();
+		_vm->_util->processInput();
 	}
 }
 
@@ -153,6 +155,8 @@
 		dither->nextLine();
 		vidMem += destDesc->getWidth();
 	}
+
+	delete dither;
 }	
 
 const byte Video_v6::_ditherPalette[768] = {


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