From 0c55fd06846f86e9b551c74a6ddff2bfcf0f3465 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Wed, 24 Nov 2004 16:59:57 +0000 Subject: [PATCH] fix some stale StepsID entries hang around after unloading edits --- stepmania/src/SongManager.cpp | 3 +++ stepmania/src/StepsUtil.cpp | 3 +-- stepmania/src/StepsUtil.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 8a4fd68318..6c591981da 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -1225,6 +1225,9 @@ void SongManager::FreeAllLoadedFromProfiles() Song* pSong = m_pSongs[s]; pSong->FreeAllLoadedFromProfiles(); } + + // After freeing some Steps pointers, the cache will be invalid. + SongID::ClearCache(); } static bool CheckPointer( const Song *p ) diff --git a/stepmania/src/StepsUtil.cpp b/stepmania/src/StepsUtil.cpp index ced7cc6f77..941fa86a59 100644 --- a/stepmania/src/StepsUtil.cpp +++ b/stepmania/src/StepsUtil.cpp @@ -195,9 +195,8 @@ XNode* StepsID::CreateNode() const } -void StepsID::Invalidate( Song *pStaleSong ) +void StepsID::ClearCache() { - // FIXME: Only flush entries with the stale song g_Cache.clear(); } diff --git a/stepmania/src/StepsUtil.h b/stepmania/src/StepsUtil.h index 8ef119e5a3..1ea2836470 100644 --- a/stepmania/src/StepsUtil.h +++ b/stepmania/src/StepsUtil.h @@ -39,7 +39,7 @@ public: void LoadFromNode( const XNode* pNode ); CString ToString() const; bool IsValid() const; - static void Invalidate( Song *pStaleSong ); + static void ClearCache(); }; #endif