From 3b8d26e56473b21fb70295b6fafa8373177bd5a5 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 16 Feb 2003 05:10:08 +0000 Subject: [PATCH] fix crash if RageSoundManager or SongManager throw --- stepmania/src/RageSoundManager.cpp | 17 ++++++++++++----- stepmania/src/SongManager.cpp | 21 +++++++++++++-------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/stepmania/src/RageSoundManager.cpp b/stepmania/src/RageSoundManager.cpp index 8f5c3d346f..5ff8e3605a 100644 --- a/stepmania/src/RageSoundManager.cpp +++ b/stepmania/src/RageSoundManager.cpp @@ -20,13 +20,20 @@ RageSoundManager::RageSoundManager(CString drivers) { /* needs to be done first */ SOUNDMAN = this; - MixVolume = 1.0f; - driver = MakeRageSoundDriver(drivers); - if(!driver) - RageException::Throw("Couldn't find a sound driver that works"); + try + { + 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() diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 0aba2f1833..4aca459acf 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -51,16 +51,21 @@ SongManager::SongManager( LoadingWindow *ld ) /* We initialize things that assume they can get at SONGMAN; we only * init one of these, so hook us up to it immediately. */ SONGMAN = this; + try + { + g_vGroupColors.clear(); + for( int i=0; i