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
This commit is contained in:
Richard Heck 2008-06-05 05:46:49 +00:00
parent ad76cb5c5f
commit 45a8fed1d5

View File

@ -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<FileName, time_t> 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<FileName, time_t> 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;
}
}