We should not remove the aux and bbl files when the Buffer is actively being exported.
void Buffer::removeBiblioTempFiles() const
{
+ if (theApp()->isBufferBusy(this)) {
+ removeBiblioTemps = true;
+ return;
+ }
+
// We remove files that contain LaTeX commands specific to the
// particular bibliographic style being used, in order to avoid
// LaTeX errors when we switch style.
Buffer const * const pbuf = parent();
if (pbuf)
pbuf->removeBiblioTempFiles();
+ removeBiblioTemps = false;
}
/// of loaded child documents).
docstring_list const &
getBibfiles(UpdateScope scope = UpdateMaster) const;
-
+ ///
+ bool needToRemoveBiblioTemps() const { return removeBiblioTemps; }
/// 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);
virtual bool unhide(Buffer * buf) = 0;
// Apply preferences at the start
static void applyPrefs();
+ ///
+ virtual bool isBufferBusy(Buffer const * b) = 0;
};
/// Return the list of loadable formats.
}
+bool GuiApplication::isBufferBusy(Buffer const * b)
+{
+ Buffer const * buf = b;
+ while (buf) {
+ if (GuiView::isBufferBusy(b))
+ return true;
+ buf = buf->parent();
+ }
+ return false;
+}
+
+
docstring Application::iconName(FuncRequest const & f, bool unknown)
{
return qstring_to_ucs4(lyx::frontend::iconInfo(f, unknown, false).filepath);
std::string inputLanguageCode() const override;
void handleKeyFunc(FuncCode action) override;
bool unhide(Buffer * buf) override;
+ bool isBufferBusy(Buffer const * b) override;
//@}
///
string last_export_format;
string processing_format;
+ // Buffers that are being exported
static QSet<Buffer const *> busyBuffers;
unsigned int smallIconSize;
}
+bool GuiView::isBufferBusy(Buffer const * b)
+{
+ return GuiViewPrivate::busyBuffers.contains(b);
+}
+
+
bool GuiView::saveBuffer(Buffer & b)
{
return saveBuffer(b, FileName());
// documents, starting from the master. so we must delete those.
Buffer * mbuf = const_cast<Buffer *>(clone->masterBuffer());
delete mbuf;
+ if (orig->needToRemoveBiblioTemps())
+ orig->removeBiblioTempFiles();
busyBuffers.remove(orig);
return status;
}
/// Current ratio between physical pixels and device-independent pixels
double pixelRatio() const;
+ ///
+ static bool isBufferBusy(Buffer const * b);
Q_SIGNALS:
void closing(int);