[Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.145,1.146 sound.h,1.35,1.36

Max Horn fingolfin at users.sourceforge.net
Thu Jun 26 16:05:05 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv10683

Modified Files:
	sound.cpp sound.h 
Log Message:
fixed memory leak when restarting

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -d -r1.145 -r1.146
--- sound.cpp	25 Jun 2003 23:49:54 -0000	1.145
+++ sound.cpp	26 Jun 2003 23:04:41 -0000	1.146
@@ -95,14 +95,13 @@
 	_current_cache = 0;
 	_current_cd_sound = 0;
 
+	_sfxFile = 0;
+	
 	_bundle = new Bundle();
 }
 
 Sound::~Sound() {
-	if (_sfxFile) {
-		_sfxFile->close();
-		delete _sfxFile;
-	}
+	delete _sfxFile;
 	delete _bundle;
 }
 
@@ -771,9 +770,10 @@
 
 		_scumm->_imuse->set_master_volume(_sound_volume_master);
 		_scumm->_imuse->set_music_volume(_sound_volume_music);
-		_scumm->_mixer->setVolume(_sound_volume_sfx * _sound_volume_master / 255);
-		_scumm->_mixer->setMusicVolume(_sound_volume_music);
 	}
+	_scumm->_mixer->setVolume(_sound_volume_sfx * _sound_volume_master / 255);
+	_scumm->_mixer->setMusicVolume(_sound_volume_music);
+	delete _sfxFile;
 	_sfxFile = openSfxFile();
 }
 
@@ -1065,7 +1065,7 @@
 	if (_pauseBundleMusic)
 		return;
 
-	if (_musicBundleToBeRemoved == true) {
+	if (_musicBundleToBeRemoved) {
 		_scumm->_timer->releaseProcedure(&music_handler);
 		_nameBundleMusic = "";
 		if (_bundleMusicTrack != -1) {
@@ -1554,7 +1554,7 @@
 }
 
 int Sound::stopMP3CD() {
-	if (_dig_cd_playing == true) {
+	if (_dig_cd_playing) {
 		_scumm->_mixer->stop(_dig_cd_index);
 		_dig_cd_playing = false;
 		_dig_cd_track = 0;
@@ -1566,8 +1566,8 @@
 	return -1;
 }
 
-int Sound::pollMP3CD() const{
-	if (_dig_cd_playing == true)
+int Sound::pollMP3CD() const {
+	if (_dig_cd_playing)
 		return 1;
 	return 0;
 }

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- sound.h	25 Jun 2003 23:49:54 -0000	1.35
+++ sound.h	26 Jun 2003 23:04:41 -0000	1.36
@@ -93,11 +93,11 @@
 	bool _dig_cd_playing;
 
 	DigitalTrackInfo *_track_info[CACHE_TRACKS];
+	int _current_cache;
 
 	Scumm *_scumm;
 
 public:
-	int _current_cache;
 	int32 _bundleMusicPosition;
 
 	int _talkChannel;	/* Mixer channel actor is talking on */





More information about the Scummvm-git-logs mailing list