From 45287844fa42efc88f5ef2c6bf6046bccd676702 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Mon, 8 Mar 2010 13:26:08 +0000 Subject: [PATCH] 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 --- src/insets/InsetInclude.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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; -- 2.39.2