diff --git a/libraries/networking/src/FileCache.cpp b/libraries/networking/src/FileCache.cpp index f0e568fcdc..43bab67ec7 100644 --- a/libraries/networking/src/FileCache.cpp +++ b/libraries/networking/src/FileCache.cpp @@ -285,10 +285,12 @@ void FileCache::wipe() { } void FileCache::clear() { + Lock lock(_mutex); + // Eliminate any overbudget files clean(); - // Mark everything remaining as persisted + // Mark everything remaining as persisted while effectively ejecting from the cache for (auto& file : _unusedFiles) { file->_shouldPersist = true; file->_cache = nullptr; @@ -323,4 +325,4 @@ File::~File() { void File::touch() { utime(_filepath.c_str(), nullptr); _modified = std::max(QFileInfo(_filepath.c_str()).lastRead().toMSecsSinceEpoch(), _modified); -} \ No newline at end of file +}