fix crash if RageSoundManager or SongManager throw
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user