The problem is caused by removing temporary aux, etc, files while
we are in the process of exporting. As Jürgen suggested, we really
do not need to remove these files until we are preparing to export:
They are not used internally. So now we just schedule the removal
and do it then.
This commit is contained in:
Richard Kimberly Heck 2024-01-11 17:23:52 -05:00
parent 082031ac8f
commit 59b08c8171
4 changed files with 15 additions and 10 deletions

View File

@ -2444,7 +2444,7 @@ void Buffer::invalidateBibinfoCache() const
{
d->bibinfo_cache_valid_ = false;
d->cite_labels_valid_ = false;
removeBiblioTempFiles();
scheduleBiblioTempRemoval();
// also invalidate the cache for the parent buffer
Buffer const * const pbuf = d->parent();
if (pbuf)
@ -2702,6 +2702,7 @@ void Buffer::removeBiblioTempFiles() const
Buffer const * const pbuf = parent();
if (pbuf)
pbuf->removeBiblioTempFiles();
removeBiblioTemps = false;
}
@ -4475,6 +4476,8 @@ void Buffer::setMathFlavor(OutputParams & op) const
Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir,
bool includeall, string & result_file) const
{
if (removeBiblioTemps)
removeBiblioTempFiles();
LYXERR(Debug::FILES, "target=" << target);
OutputParams runparams(&params().encoding());
string format = target;

View File

@ -538,9 +538,6 @@ public:
/// dereferenced label name
void getLabelList(std::vector<std::tuple<docstring, docstring, docstring>> &) const;
/// This removes the .aux and .bbl files from the temp dir.
void removeBiblioTempFiles() const;
///
void changeLanguage(Language const * from, Language const * to);
@ -704,6 +701,8 @@ private:
///
ExportStatus doExport(std::string const & target, bool put_in_tempdir,
std::string & result_file) const;
/// This removes the .aux and .bbl files from the temp dir.
void removeBiblioTempFiles() const;
/// target is a format name optionally followed by a space
/// and a destination file-name
ExportStatus doExport(std::string const & target, bool put_in_tempdir,
@ -806,18 +805,20 @@ public:
/// of loaded child documents).
docstring_list const &
getBibfiles(UpdateScope scope = UpdateMaster) const;
///
void scheduleBiblioTempRemoval() const { removeBiblioTemps = true; }
/// routines for dealing with possible self-inclusion
void pushIncludedBuffer(Buffer const * buf) const;
void popIncludedBuffer() const;
bool isBufferIncluded(Buffer const * buf) const;
private:
void clearIncludeList() const;
private:
///
friend class MarkAsExporting;
/// mark the buffer as busy exporting something, or not
void setExportStatus(bool e) const;
///
mutable bool removeBiblioTemps = false;
///
References & getReferenceCache(docstring const & label);

View File

@ -527,6 +527,7 @@ public:
string last_export_format;
string processing_format;
// Buffers that are being exported
static QSet<Buffer const *> busyBuffers;
unsigned int smallIconSize;

View File

@ -50,7 +50,7 @@ namespace lyx {
InsetCitation::InsetCitation(Buffer * buf, InsetCommandParams const & p)
: InsetCommand(buf, p)
{
buffer().removeBiblioTempFiles();
buffer().scheduleBiblioTempRemoval();
cleanKeys();
}
@ -61,7 +61,7 @@ InsetCitation::~InsetCitation()
/* We do not use buffer() because Coverity believes that this
* may throw an exception. Actually this code path is not
* taken when buffer_ == 0 */
buffer_->removeBiblioTempFiles();
buffer_->scheduleBiblioTempRemoval();
}
@ -142,7 +142,7 @@ void InsetCitation::doDispatch(Cursor & cur, FuncRequest & cmd)
openCitation();
break;
case LFUN_INSET_MODIFY: {
buffer().removeBiblioTempFiles();
buffer().scheduleBiblioTempRemoval();
cache.recalculate = true;
if (cmd.getArg(0) == "toggleparam") {
string cmdname = getCmdName();