@@ -625,7 +625,6 @@ class FilterCache
625625 // ! the same file can be performed efficiently
626626 bool getFileContents (const QCString &fileName,size_t startLine,size_t endLine, std::string &str)
627627 {
628- std::lock_guard<std::mutex> lock (m_mutex);
629628 bool filterSourceFiles = Config_getBool (FILTER_SOURCE_FILES);
630629 QCString filter = getFileFilter (fileName,TRUE );
631630 bool usePipe = !filter.isEmpty () && filterSourceFiles;
@@ -636,9 +635,11 @@ class FilterCache
636635 bool getFileContentsPipe (const QCString &fileName,const QCString &filter,
637636 size_t startLine,size_t endLine,std::string &str)
638637 {
638+ std::unique_lock<std::mutex> lock (m_mutex);
639639 auto it = m_cache.find (fileName.str ());
640640 if (it!=m_cache.end ()) // cache hit: reuse stored result
641641 {
642+ lock.unlock ();
642643 auto item = it->second ;
643644 // printf("getFileContents(%s): cache hit\n",qPrint(fileName));
644645 // file already processed, get the results after filtering from the tmp file
@@ -717,6 +718,7 @@ class FilterCache
717718 // ! into buffer \a str
718719 bool getFileContentsDisk (const QCString &fileName,size_t startLine,size_t endLine,std::string &str)
719720 {
721+ std::unique_lock<std::mutex> lock (m_mutex);
720722 // normal file
721723 // printf("getFileContents(%s): no filter\n",qPrint(fileName));
722724 auto it = m_lineOffsets.find (fileName.str ());
@@ -729,6 +731,7 @@ class FilterCache
729731 }
730732 else // file already processed before
731733 {
734+ lock.unlock ();
732735 auto [ startLineOffset, fragmentSize] = getFragmentLocation (it->second ,startLine,endLine);
733736 // printf("%s: existing file [%zu-%zu] -> start=%zu size=%zu\n",
734737 // qPrint(fileName),startLine,endLine,startLineOffset,fragmentSize);
0 commit comments