mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 11:52:25 +00:00
Check the bibliography cache only when we really need to do so. This (a)
prevents weirdness that might happen if the .bib file were to change during updateLabels(), (b) prevents even further weirdness that might happen if it changed during the output routines, and (c) ought to avoid slowness caused by the repeated calls to QFileInfo::refresh() needed to check the cache status. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32972 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
9173c27897
commit
ce87e6767c
@ -1671,7 +1671,6 @@ BiblioInfo const & Buffer::masterBibInfo() const
|
||||
|
||||
BiblioInfo const & Buffer::localBibInfo() const
|
||||
{
|
||||
checkBibInfoCache();
|
||||
return d->bibinfo_;
|
||||
}
|
||||
|
||||
@ -2822,6 +2821,7 @@ void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
|
||||
// Check if the label 'from' appears more than once
|
||||
vector<docstring> labels;
|
||||
string paramName;
|
||||
checkBibInfoCache();
|
||||
BiblioInfo const & keys = masterBibInfo();
|
||||
BiblioInfo::const_iterator bit = keys.begin();
|
||||
BiblioInfo::const_iterator bend = keys.end();
|
||||
@ -3495,6 +3495,10 @@ void Buffer::updateLabels(UpdateScope scope, bool out) const
|
||||
Buffer const * const master = masterBuffer();
|
||||
DocumentClass const & textclass = master->params().documentClass();
|
||||
|
||||
// do this only if we are the top-level Buffer
|
||||
if (scope != UpdateMaster || master == this)
|
||||
checkBibInfoCache();
|
||||
|
||||
// keep the buffers to be children in this set. If the call from the
|
||||
// master comes back we can see which of them were actually seen (i.e.
|
||||
// via an InsetInclude). The remaining ones in the set need still be updated.
|
||||
|
18
src/Buffer.h
18
src/Buffer.h
@ -350,15 +350,23 @@ public:
|
||||
*/
|
||||
void validate(LaTeXFeatures &) const;
|
||||
|
||||
/// Update the cache with all bibfiles in use (including bibfiles
|
||||
/// Update the list of all bibfiles in use (including bibfiles
|
||||
/// of loaded child documents).
|
||||
void updateBibfilesCache(UpdateScope scope = UpdateMaster) const;
|
||||
///
|
||||
void invalidateBibinfoCache();
|
||||
/// Return the cache with all bibfiles in use (including bibfiles
|
||||
/// Return the list with all bibfiles in use (including bibfiles
|
||||
/// of loaded child documents).
|
||||
support::FileNameList const &
|
||||
getBibfilesCache(UpdateScope scope = UpdateMaster) const;
|
||||
/// Information from BibTeX databases is cached in the Buffer, so
|
||||
/// we do not have to read the file over and over.
|
||||
/// Calling this method invalidates the cache and so requires a
|
||||
/// re-read.
|
||||
void invalidateBibinfoCache();
|
||||
/// Updates the cached bibliography information.
|
||||
/// Note that you MUST call this method to update the cache. It will
|
||||
/// not happen otherwise. (Currently, it is called at the start of
|
||||
/// updateLabels() and from GuiCitation.)
|
||||
void checkBibInfoCache() const;
|
||||
/// \return the bibliography information for this buffer's master,
|
||||
/// or just for it, if it isn't a child.
|
||||
BiblioInfo const & masterBibInfo() const;
|
||||
@ -571,8 +579,6 @@ private:
|
||||
void updateMacros(DocIterator & it,
|
||||
DocIterator & scope) const;
|
||||
///
|
||||
void checkBibInfoCache() const;
|
||||
///
|
||||
void setLabel(ParIterator & it) const;
|
||||
///
|
||||
void collectRelatives(BufferSet & bufs) const;
|
||||
|
@ -735,6 +735,7 @@ void GuiCitation::dispatchParams()
|
||||
|
||||
BiblioInfo const & GuiCitation::bibInfo() const
|
||||
{
|
||||
buffer().checkBibInfoCache();
|
||||
return buffer().masterBibInfo();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user