fix crash if RageSoundManager or SongManager throw

This commit is contained in:
Glenn Maynard
2003-02-16 05:10:08 +00:00
parent 3f9504b7b9
commit 3b8d26e564
2 changed files with 25 additions and 13 deletions
+12 -5
View File
@@ -20,13 +20,20 @@ RageSoundManager::RageSoundManager(CString drivers)
{ {
/* needs to be done first */ /* needs to be done first */
SOUNDMAN = this; SOUNDMAN = this;
MixVolume = 1.0f;
driver = MakeRageSoundDriver(drivers); try
if(!driver) {
RageException::Throw("Couldn't find a sound driver that works"); MixVolume = 1.0f;
music = new RageSound; driver = MakeRageSoundDriver(drivers);
if(!driver)
RageException::Throw("Couldn't find a sound driver that works");
music = new RageSound;
} catch(...) {
SOUNDMAN = NULL;
throw;
}
} }
RageSoundManager::~RageSoundManager() RageSoundManager::~RageSoundManager()
+13 -8
View File
@@ -51,16 +51,21 @@ SongManager::SongManager( LoadingWindow *ld )
/* We initialize things that assume they can get at SONGMAN; we only /* We initialize things that assume they can get at SONGMAN; we only
* init one of these, so hook us up to it immediately. */ * init one of these, so hook us up to it immediately. */
SONGMAN = this; SONGMAN = this;
try
{
g_vGroupColors.clear();
for( int i=0; i<NUM_GROUP_COLORS; i++ )
g_vGroupColors.push_back( GROUP_COLOR(i) );
g_ExtraColor = EXTRA_COLOR;
g_vGroupColors.clear(); InitSongArrayFromDisk( ld );
for( int i=0; i<NUM_GROUP_COLORS; i++ ) InitMachineScoresFromDisk();
g_vGroupColors.push_back( GROUP_COLOR(i) );
g_ExtraColor = EXTRA_COLOR;
InitSongArrayFromDisk( ld ); InitCoursesFromDisk();
InitMachineScoresFromDisk(); } catch(...) {
SONGMAN = NULL;
InitCoursesFromDisk(); throw;
}
} }
SongManager::~SongManager() SongManager::~SongManager()