[Scummvm-cvs-logs] SF.net SVN: scummvm:[47276] scummvm/trunk/engines/sci/sound/softseq/adlib. cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Jan 12 21:26:58 CET 2010


Revision: 47276
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47276&view=rev
Author:   lordhoto
Date:     2010-01-12 20:26:49 +0000 (Tue, 12 Jan 2010)

Log Message:
-----------
Fix memory leak in MidiPlayer_Adlib.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sound/softseq/adlib.cpp

Modified: scummvm/trunk/engines/sci/sound/softseq/adlib.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/softseq/adlib.cpp	2010-01-12 20:19:45 UTC (rev 47275)
+++ scummvm/trunk/engines/sci/sound/softseq/adlib.cpp	2010-01-12 20:26:49 UTC (rev 47276)
@@ -161,7 +161,11 @@
 class MidiPlayer_Adlib : public MidiPlayer {
 public:
 	MidiPlayer_Adlib() { _driver = new MidiDriver_Adlib(g_system->getMixer()); }
+	~MidiPlayer_Adlib() {}
+
 	int open(ResourceManager *resMan);
+	void close();
+
 	byte getPlayId(SciVersion soundVersion);
 	int getPolyphony() const { return MidiDriver_Adlib::kVoices; }
 	bool hasRhythmChannel() const { return false; }
@@ -812,6 +816,14 @@
 	return static_cast<MidiDriver_Adlib *>(_driver)->open(getSciVersion() <= SCI_VERSION_0_LATE);
 }
 
+void MidiPlayer_Adlib::close() {
+	if (_driver) {
+		_driver->close();
+		delete _driver;
+		_driver = 0;
+	}
+}
+
 byte MidiPlayer_Adlib::getPlayId(SciVersion soundVersion) {
 	switch (soundVersion) {
 	case SCI_VERSION_0_EARLY:


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