commit 149526c15472a1a89c046133f5e33914f44f2d28
Author: Juergen Spitzmueller <[email protected]>
Date:   Sat Oct 13 11:06:24 2018 +0200

    Clear bibfile cache when set of bibliography files change
    
    Part of #9158
    
    (cherry picked from commit 4115d2487f57f58774ee2846aa2b35818c0bc1b9)
---
 src/Buffer.cpp             |    8 +++++++-
 src/Buffer.h               |    4 ++--
 src/insets/InsetBibtex.cpp |    1 +
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 583d3db..fce5b4c 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -2470,6 +2470,12 @@ void Buffer::checkIfBibInfoCacheIsValid() const
 }
 
 
+void Buffer::clearBibFileCache() const
+{
+       bibfileCache.clear();
+}
+
+
 void Buffer::reloadBibInfoCache() const
 {
        // use the master's cache
@@ -2487,7 +2493,7 @@ void Buffer::reloadBibInfoCache() 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 57efb8d..f30b1a3 100644
--- a/src/Buffer.h
+++ b/src/Buffer.h
@@ -509,8 +509,8 @@ public:
        /// Calling this method invalidates the cache and so requires a
        /// re-read.
        void invalidateBibinfoCache() const;
-       /// This invalidates the cache of files we need to check.
-       void invalidateBibfileCache() 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 5f1b31a..9724e95 100644
--- a/src/insets/InsetBibtex.cpp
+++ b/src/insets/InsetBibtex.cpp
@@ -117,6 +117,7 @@ void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & 
cmd)
                cur.recordUndo();
                setParams(p);
                buffer().removeBiblioTempFiles();
+               cur.buffer()->clearBibFileCache();
                cur.forceBufferUpdate();
                break;
        }

Reply via email to