fix crashes on reload and cleanup

This commit is contained in:
Glenn Maynard
2004-05-29 20:15:07 +00:00
parent 16c2050112
commit 5bb3d0f72b
+11 -3
View File
@@ -115,9 +115,6 @@ void SongManager::Reload( LoadingWindow *ld )
FreeSongs();
FreeCourses();
m_sGroupNames.clear();
m_sGroupBannerPaths.clear();
/* Always check songs for changes. */
const bool OldVal = PREFSMAN->m_bFastLoad;
PREFSMAN->m_bFastLoad = false;
@@ -316,11 +313,18 @@ void SongManager::PreloadSongImages()
void SongManager::FreeSongs()
{
m_sGroupNames.clear();
m_sGroupBannerPaths.clear();
for( unsigned i=0; i<m_pSongs.size(); i++ )
SAFE_DELETE( m_pSongs[i] );
m_pSongs.clear();
m_sGroupBannerPaths.clear();
for( int i = 0; i < NUM_PROFILE_SLOTS; ++i )
m_pBestSongs[i].clear();
m_pShuffledSongs.clear();
}
CString SongManager::GetGroupBannerPath( CString sGroupName )
@@ -638,6 +642,10 @@ void SongManager::FreeCourses()
for( unsigned i=0; i<m_pCourses.size(); i++ )
delete m_pCourses[i];
m_pCourses.clear();
for( int i = 0; i < NUM_PROFILE_SLOTS; ++i )
m_pBestCourses[i].clear();
m_pShuffledCourses.clear();
}
/* Called periodically to wipe out cached NoteData. This is called when we change