fix crash on exiting editor

clean up invalidation of Song and Courses
This commit is contained in:
Chris Danford
2004-08-12 04:49:15 +00:00
parent cbe80105fb
commit 873c148f0e
7 changed files with 35 additions and 22 deletions
+10 -5
View File
@@ -142,14 +142,17 @@ void StepsID::FromSteps( const Steps *p )
* to have access to Song::m_LoadedFromProfile. */
static map<StepsID,Steps *> g_StepsIDCache;
Steps *StepsID::ToSteps( const Song *p, bool bAllowNull ) const
Steps *StepsID::ToSteps( const Song *p, bool bAllowNull, bool bUseCache ) const
{
if( st == STEPS_TYPE_INVALID || dc == DIFFICULTY_INVALID )
return NULL;
map<StepsID,Steps *>::iterator it = g_StepsIDCache.find( *this );
if( it != g_StepsIDCache.end() )
return it->second;
if( bUseCache )
{
map<StepsID,Steps *>::iterator it = g_StepsIDCache.find( *this );
if( it != g_StepsIDCache.end() )
return it->second;
}
vector<Steps*> vNotes;
if( dc == DIFFICULTY_EDIT )
@@ -163,7 +166,9 @@ Steps *StepsID::ToSteps( const Song *p, bool bAllowNull ) const
else if( !bAllowNull )
RageException::Throw( "%i, %i, \"%s\"", st, dc, sDescription.c_str() );
g_StepsIDCache[*this] = ret;
if( bUseCache )
g_StepsIDCache[*this] = ret;
return ret;
}