diff --git a/stepmania/src/RageFileDriverTimeout.cpp b/stepmania/src/RageFileDriverTimeout.cpp index 96f1b75b70..c2b39d277b 100644 --- a/stepmania/src/RageFileDriverTimeout.cpp +++ b/stepmania/src/RageFileDriverTimeout.cpp @@ -596,6 +596,12 @@ int ThreadedFileWorker::Remove( const CString &sPath ) bool ThreadedFileWorker::FlushDirCache( const CString &sPath ) { + /* FlushDirCache() is often called globally, on all drivers, which means it's called with + * no timeout. Temporarily enable a timeout if needed. */ + bool bTimeoutEnabled = TimeoutEnabled(); + if( !bTimeoutEnabled ) + SetTimeout(1); + if( m_pChildDriver == NULL ) return false; @@ -608,10 +614,16 @@ bool ThreadedFileWorker::FlushDirCache( const CString &sPath ) /* Kick off the worker thread, and wait for it to finish. */ if( !DoRequest(REQ_FLUSH_DIR_CACHE) ) { + if( !bTimeoutEnabled ) + SetTimeout(-1); + LOG->Trace( "FlushDirCache(%s) timed out", sPath.c_str() ); return false; } + if( !bTimeoutEnabled ) + SetTimeout(-1); + return true; }