From 4115d2487f57f58774ee2846aa2b35818c0bc1b9 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sat, 13 Oct 2018 11:06:24 +0200 Subject: [PATCH] Clear bibfile cache when set of bibliography files change Part of #9158 --- src/Buffer.cpp | 8 +++++++- src/Buffer.h | 2 ++ src/insets/InsetBibtex.cpp | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 64e4e0fb04..2809fdf8b7 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -2492,6 +2492,12 @@ void Buffer::checkIfBibInfoCacheIsValid() const } +void Buffer::clearBibFileCache() const +{ + bibfileCache.clear(); +} + + void Buffer::reloadBibInfoCache(bool const force) const { // use the master's cache @@ -2511,7 +2517,7 @@ void Buffer::reloadBibInfoCache(bool const force) const // FIXME Is this sufficient? Or should we also force that // in some other cases? If so, then it is easy enough to // add the following line in some other places. - bibfileCache.clear(); + clearBibFileCache(); d->bibinfo_.clear(); FileNameList checkedFiles; collectBibKeys(checkedFiles); diff --git a/src/Buffer.h b/src/Buffer.h index c68f09de99..4037e5a1e6 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -500,6 +500,8 @@ public: /// Calling this method invalidates the cache and so requires a /// re-read. void invalidateBibinfoCache() const; + /// Clear the bibfiles cache + void clearBibFileCache() const; /// Updates the cached bibliography information, checking first to see /// whether the cache is valid. If so, we do nothing. If not, then we /// reload all the BibTeX info. diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index d5798630a7..ae76a7f26c 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -105,6 +105,7 @@ void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & cmd) cur.recordUndo(); setParams(p); + cur.buffer()->clearBibFileCache(); cur.forceBufferUpdate(); break; } -- 2.39.2