From 45a8fed1d5380f9af648efc0791e4967e19eb715 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 5 Jun 2008 05:46:49 +0000 Subject: [PATCH] Fix bug 4899. My bad. There are still some problems here, also related to the cache. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25134 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Buffer.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index afe016b70c..ccba24493d 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -204,8 +204,14 @@ public: /// documents), needed for appropriate update of natbib labels. mutable support::FileNameList bibfilesCache_; + // FIXME The caching mechanism could be improved. At present, we have a + // cache for each Buffer, that caches all the bibliography info for that + // Buffer. A more efficient solution would be to have a global cache per + // file, and then to construct the Buffer's bibinfo from that. /// A cache for bibliography info mutable BiblioInfo bibinfo_; + /// Cache of timestamps of .bib files + map bibfileStatus_; mutable RefCache ref_cache_; @@ -1369,10 +1375,7 @@ BiblioInfo const & Buffer::masterBibInfo() const BiblioInfo const & Buffer::localBibInfo() const -{ - // cache the timestamp of the bibliography files. - static map bibfileStatus; - +{ support::FileNameList const & bibfilesCache = getBibfilesCache(); // compare the cached timestamps with the actual ones. bool changed = false; @@ -1380,9 +1383,9 @@ BiblioInfo const & Buffer::localBibInfo() const support::FileNameList::const_iterator en = bibfilesCache.end(); for (; ei != en; ++ ei) { time_t lastw = ei->lastModified(); - if (lastw != bibfileStatus[*ei]) { + if (lastw != d->bibfileStatus_[*ei]) { changed = true; - bibfileStatus[*ei] = lastw; + d->bibfileStatus_[*ei] = lastw; break; } } -- 2.39.2