From: Richard Heck Date: Mon, 8 Mar 2010 13:26:08 +0000 (+0000) Subject: Add sanity check. This partially fixes a crash related to saving master X-Git-Tag: 2.0.0~3869 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=45287844fa42efc88f5ef2c6bf6046bccd676702;p=features.git Add sanity check. This partially fixes a crash related to saving master documents to new locations. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33670 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index ccd0dda6ac..575bfecd6c 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -412,18 +412,18 @@ Buffer * InsetInclude::loadIfNeeded() const if (failedtoload_ || isVerbatim(params()) || isListings(params())) return 0; + FileName const included_file = includedFilename(buffer(), params()); // Use cached Buffer if possible. if (child_buffer_ != 0) { - if (theBufferList().isLoaded(child_buffer_)) + if (theBufferList().isLoaded(child_buffer_) + // additional sanity check: make sure the Buffer really is + // associated with the file we want. + && child_buffer_ == theBufferList().getBuffer(included_file)) return child_buffer_; // Buffer vanished, so invalidate cache and try to reload. child_buffer_ = 0; } - string const parent_filename = buffer().absFileName(); - FileName const included_file = - makeAbsPath(to_utf8(params()["filename"]), onlyPath(parent_filename)); - if (!isLyXFilename(included_file.absFilename())) return 0;