From c8a252ee778457da0e14cd3ce60ef2e649e287a2 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 6 Nov 2004 03:21:19 +0000 Subject: [PATCH] fix m_FinishedRequests not being cleared on Abort() --- stepmania/src/RageUtil_BackgroundLoader.cpp | 6 +++++- stepmania/src/RageUtil_BackgroundLoader.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/stepmania/src/RageUtil_BackgroundLoader.cpp b/stepmania/src/RageUtil_BackgroundLoader.cpp index 6c18bb4f00..94bfdd4054 100644 --- a/stepmania/src/RageUtil_BackgroundLoader.cpp +++ b/stepmania/src/RageUtil_BackgroundLoader.cpp @@ -206,7 +206,7 @@ bool BackgroundLoader::IsCacheFileFinished( const CString &sFile, CString &sActu return true; } -void BackgroundLoader::FinishedWithCachedFile( const CString &sFile ) +void BackgroundLoader::FinishedWithCachedFile( CString sFile ) { if( !g_bEnableBackgroundLoading ) return; @@ -238,6 +238,10 @@ void BackgroundLoader::Abort() while( !GetRequest().empty() ) ; + /* Clear any previously finished requests. */ + while( m_FinishedRequests.size() ) + FinishedWithCachedFile( m_FinishedRequests.begin()->first ); + /* Tell the thread to abort any request it's handling now. */ if( m_sThreadIsActive ) m_sThreadShouldAbort = true; diff --git a/stepmania/src/RageUtil_BackgroundLoader.h b/stepmania/src/RageUtil_BackgroundLoader.h index 8bf591e4e5..8ac2338633 100644 --- a/stepmania/src/RageUtil_BackgroundLoader.h +++ b/stepmania/src/RageUtil_BackgroundLoader.h @@ -25,7 +25,7 @@ public: bool IsCacheFileFinished( const CString &sFile, CString &sActualPath ); /* Call this when finished with a cached file, to release any resources. */ - void FinishedWithCachedFile( const CString &sFile ); + void FinishedWithCachedFile( CString sFile ); /* Abort all loads. */ void Abort();