From 39bc3f3f934a124687e7a7676d991d23390ee276 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Mon, 24 Nov 2008 12:45:18 +0000 Subject: [PATCH] Fix most of bug 5539. If a file fails to load, we do not try to load it again. The downside is that, even if you fixed the problem, then LyX won't try to load it again in that session. I tried resetting the failedtoload_ variable in fileChanged(), but that didn't work, as it doesn't seem to get hit. I'm not sure what to do here, but it isn't a huge issue. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27688 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetInclude.cpp | 10 ++++++++-- src/insets/InsetInclude.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index de084f6568..d9182f2fdb 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -160,7 +160,8 @@ InsetLabel * createLabel(docstring const & label_str) InsetInclude::InsetInclude(InsetCommandParams const & p) : InsetCommand(p, "include"), include_label(uniqueID()), - preview_(new RenderMonitoredPreview(this)), set_label_(false), label_(0) + preview_(new RenderMonitoredPreview(this)), failedtoload_(false), + set_label_(false), label_(0) { preview_->fileChanged(boost::bind(&InsetInclude::fileChanged, this)); @@ -173,7 +174,8 @@ InsetInclude::InsetInclude(InsetCommandParams const & p) InsetInclude::InsetInclude(InsetInclude const & other) : InsetCommand(other), include_label(other.include_label), - preview_(new RenderMonitoredPreview(this)), set_label_(false), label_(0) + preview_(new RenderMonitoredPreview(this)), failedtoload_(false), + set_label_(false), label_(0) { preview_->fileChanged(boost::bind(&InsetInclude::fileChanged, this)); @@ -371,6 +373,9 @@ Buffer * InsetInclude::getChildBuffer(Buffer const & buffer) const Buffer * InsetInclude::loadIfNeeded(Buffer const & parent) const { InsetCommandParams const & p = params(); + if (failedtoload_) + return 0; + if (isVerbatim(p) || isListings(p)) return 0; @@ -393,6 +398,7 @@ Buffer * InsetInclude::loadIfNeeded(Buffer const & parent) const return 0; if (!child->loadLyXFile(included_file)) { + failedtoload_ = true; //close the buffer we just opened theBufferList().release(child); return 0; diff --git a/src/insets/InsetInclude.h b/src/insets/InsetInclude.h index 5dc660e8d4..3afb11ecee 100644 --- a/src/insets/InsetInclude.h +++ b/src/insets/InsetInclude.h @@ -125,6 +125,8 @@ private: /// The pointer never changes although *preview_'s contents may. boost::scoped_ptr const preview_; + /// + mutable bool failedtoload_; /// cache mutable bool set_label_; mutable RenderButton button_;