From: Richard Kimberly Heck Date: Wed, 25 Apr 2018 17:40:37 +0000 (-0400) Subject: Don't sort the bibfiles cache. X-Git-Tag: lyx-2.4.0dev-acb2ca7b~3558 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=6b095e2b7107110bec593edd02bbdcf25adae76a;p=features.git Don't sort the bibfiles cache. This causes problems with biblatex. Instead, we sort the old and new lists and then compare them. --- diff --git a/src/Buffer.cpp b/src/Buffer.cpp index ee27f8f69d..74d5ac8deb 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -4791,9 +4791,13 @@ void Buffer::updateBuffer(UpdateScope scope, UpdateType utype) const return; // if the bibfiles changed, the cache of bibinfo is invalid - sort(d->bibfiles_cache_.begin(), d->bibfiles_cache_.end()); - // the old one should already be sorted - if (old_bibfiles != d->bibfiles_cache_) { + FileNamePairList new_bibfiles = d->bibfiles_cache_; + // this is a trick to determine whether the two vectors have + // the same elements. + sort(new_bibfiles.begin(), new_bibfiles.end()); + sort(old_bibfiles.begin(), old_bibfiles.end()); + if (old_bibfiles != new_bibfiles) { + LYXERR(Debug::FILES, "Reloading bibinfo cache."); invalidateBibinfoCache(); reloadBibInfoCache(); // We relied upon the bibinfo cache when recalculating labels. But that @@ -4810,8 +4814,11 @@ void Buffer::updateBuffer(UpdateScope scope, UpdateType utype) const // updateMacros(); setChangesPresent(false); updateBuffer(parit, utype); + // this will already have been done by reloadBibInfoCache(); + // d->bibinfo_cache_valid_ = true; } else { + LYXERR(Debug::FILES, "Bibfiles unchanged."); // this is also set to true on the other path, by reloadBibInfoCache. d->bibinfo_cache_valid_ = true; }