[Scummvm-cvs-logs] SF.net SVN: scummvm: [31244] scummvm/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Mar 26 20:29:33 CET 2008


Revision: 31244
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31244&view=rev
Author:   fingolfin
Date:     2008-03-26 12:29:33 -0700 (Wed, 26 Mar 2008)

Log Message:
-----------
Modified Patch #1925352: Memory leak fixes

Modified Paths:
--------------
    scummvm/trunk/backends/platform/sdl/graphics.cpp
    scummvm/trunk/backends/platform/sdl/sdl.cpp
    scummvm/trunk/base/main.cpp
    scummvm/trunk/common/singleton.h
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/graphics/scaler.cpp
    scummvm/trunk/graphics/scaler.h
    scummvm/trunk/sound/softsynth/adlib.cpp

Modified: scummvm/trunk/backends/platform/sdl/graphics.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/graphics.cpp	2008-03-26 16:11:47 UTC (rev 31243)
+++ scummvm/trunk/backends/platform/sdl/graphics.cpp	2008-03-26 19:29:33 UTC (rev 31244)
@@ -459,6 +459,7 @@
 		_osdSurface = NULL;
 	}
 #endif
+	DestroyScalers();
 }
 
 void OSystem_SDL::hotswapGFXMode() {

Modified: scummvm/trunk/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.cpp	2008-03-26 16:11:47 UTC (rev 31243)
+++ scummvm/trunk/backends/platform/sdl/sdl.cpp	2008-03-26 19:29:33 UTC (rev 31244)
@@ -309,9 +309,23 @@
 	if (_joystick)
 		SDL_JoystickClose(_joystick);
 	SDL_ShowCursor(SDL_ENABLE);
+
+	SDL_RemoveTimer(_timerID);
+	SDL_CloseAudio();
+
+	free(_dirtyChecksums);
+	free(_currentPalette);
+	free(_cursorPalette);
+	free(_mouseData);
+
+	delete _savefile;
+	delete _mixer;
+	delete _timer;
+
 	SDL_Quit();
 
 	delete getEventManager();
+
 	exit(0);
 }
 

Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp	2008-03-26 16:11:47 UTC (rev 31243)
+++ scummvm/trunk/base/main.cpp	2008-03-26 19:29:33 UTC (rev 31244)
@@ -329,6 +329,10 @@
 
 		launcherDialog(system);
 	}
+	PluginManager::instance().unloadPluginsExcept(NULL);
+	PluginManager::instance().destroy();
+	ConfMan.destroy();
+	delete g_gui.theme();
 
 	return 0;
 }

Modified: scummvm/trunk/common/singleton.h
===================================================================
--- scummvm/trunk/common/singleton.h	2008-03-26 16:11:47 UTC (rev 31243)
+++ scummvm/trunk/common/singleton.h	2008-03-26 19:29:33 UTC (rev 31244)
@@ -71,6 +71,10 @@
 			_singleton = T::makeInstance();
 		return *_singleton;
 	}
+	virtual void destroy() {
+		delete _singleton;
+		_singleton = 0;
+	}
 protected:
 	Singleton<T>()		{ }
 #ifdef __SYMBIAN32__

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2008-03-26 16:11:47 UTC (rev 31243)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2008-03-26 19:29:33 UTC (rev 31244)
@@ -885,6 +885,8 @@
 		delete _splayer;
 	}
 
+	delete _insane;
+
 	free(_languageBuffer);
 	free(_languageIndex);
 }
@@ -1201,6 +1203,7 @@
 		_fmtownsBuf = (byte *)malloc(_screenWidth * _textSurfaceMultiplier * _screenHeight * _textSurfaceMultiplier);
 	}
 
+	free(_compositeBuf);
 	_compositeBuf = (byte *)malloc(_screenWidth * _textSurfaceMultiplier * _screenHeight * _textSurfaceMultiplier);
 }
 

Modified: scummvm/trunk/graphics/scaler.cpp
===================================================================
--- scummvm/trunk/graphics/scaler.cpp	2008-03-26 16:11:47 UTC (rev 31243)
+++ scummvm/trunk/graphics/scaler.cpp	2008-03-26 19:29:33 UTC (rev 31244)
@@ -27,7 +27,6 @@
 #include "graphics/scaler/scalebit.h"
 #include "common/util.h"
 
-
 int gBitFormat = 565;
 
 #ifndef DISABLE_HQ_SCALERS
@@ -112,7 +111,12 @@
 #endif
 }
 
+void DestroyScalers(){
+	free(RGBtoYUV);
+	free(LUT16to32);
+}
 
+
 /**
  * Trivial 'scaler' - in fact it doesn't do any scaling but just copies the
  * source to the destionation.

Modified: scummvm/trunk/graphics/scaler.h
===================================================================
--- scummvm/trunk/graphics/scaler.h	2008-03-26 16:11:47 UTC (rev 31243)
+++ scummvm/trunk/graphics/scaler.h	2008-03-26 19:29:33 UTC (rev 31244)
@@ -29,6 +29,7 @@
 #include "graphics/surface.h"
 
 extern void InitScalers(uint32 BitFormat);
+extern void DestroyScalers();
 
 typedef void ScalerProc(const uint8 *srcPtr, uint32 srcPitch,
 							uint8 *dstPtr, uint32 dstPitch, int width, int height);

Modified: scummvm/trunk/sound/softsynth/adlib.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/adlib.cpp	2008-03-26 16:11:47 UTC (rev 31243)
+++ scummvm/trunk/sound/softsynth/adlib.cpp	2008-03-26 19:29:33 UTC (rev 31244)
@@ -871,6 +871,7 @@
 	}
 
 	// Turn off the OPL emulation
+	OPLDestroy(_opl);
 //	YM3812Shutdown();
 
 	free(_adlib_reg_cache);


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