[Scummvm-cvs-logs] SF.net SVN: scummvm:[44740] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Oct 7 19:29:37 CEST 2009


Revision: 44740
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44740&view=rev
Author:   thebluegr
Date:     2009-10-07 17:29:37 +0000 (Wed, 07 Oct 2009)

Log Message:
-----------
Implemented the SciGuiView destructor and plugged a memory leak in the current GUI

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
    scummvm/trunk/engines/sci/gui/gui_view.cpp

Modified: scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-10-07 17:01:19 UTC (rev 44739)
+++ scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-10-07 17:29:37 UTC (rev 44740)
@@ -554,7 +554,6 @@
 				curCel->index_data = (byte *)malloc(celInfo->width * celInfo->height);
 				byte *tmpBuffer = guiView->getBitmap(i, j);
 				memcpy(curCel->index_data, tmpBuffer, celInfo->width * celInfo->height);
-				delete tmpBuffer;
 				curCel->flags = 0;
 				curCel->width = celInfo->width;
 				curCel->height = celInfo->height;
@@ -569,6 +568,8 @@
 			}
 		}
 
+		delete guiView;
+
 		if (!res) {
 			res = (gfx_resource_t *)malloc(sizeof(gfx_resource_t));
 			res->scaled_data.view = NULL;

Modified: scummvm/trunk/engines/sci/gui/gui_view.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_view.cpp	2009-10-07 17:01:19 UTC (rev 44739)
+++ scummvm/trunk/engines/sci/gui/gui_view.cpp	2009-10-07 17:29:37 UTC (rev 44740)
@@ -40,6 +40,15 @@
 }
 
 SciGuiView::~SciGuiView() {
+	// Iterate through the loops
+	for (uint16 loopNum = 0; loopNum < _loopCount; loopNum++) {
+		// and through the cells of each loop
+		for (uint16 celNum = 0; celNum < _loop[loopNum].celCount; celNum++) {
+			delete _loop[loopNum].cel[celNum].rawBitmap;
+		}
+		delete _loop[loopNum].cel;
+	}
+	delete _loop;
 }
 
 static const byte EGAMappingDefault[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };


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