José Matos wrote: > On Thursday 24 May 2007 08:55:31 Jean-Marc Lasgouttes wrote: > >> Richard> Seeking two OKs to commit. >> >> This looks good. >> > +1 > I'd feel happiest committing this with or after the fix for 2199. I don't believe it solves this crash all by itself. The 2199 one is waiting approval. I'll attach a combined diff. It's one bug, more or less.
Richard -- ================================================================== Richard G Heck, Jr Professor of Philosophy Brown University http://frege.brown.edu/heck/ ================================================================== Get my public key from http://sks.keyserver.penguin.de Hash: 0x1DE91F1E66FFBDEC Learn how to sign your email using Thunderbird and GnuPG at: http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto
Index: src/LyXFunc.cpp =================================================================== --- src/LyXFunc.cpp (revision 18489) +++ src/LyXFunc.cpp (working copy) @@ -1413,18 +1413,20 @@ BOOST_ASSERT(lyx_view_); FileName const filename = makeAbsPath(argument, lyx_view_->buffer()->filePath()); - setMessage(bformat(_("Opening child document %1$s..."), - makeDisplayPath(filename.absFilename()))); view()->saveBookmark(false); string const parentfilename = lyx_view_->buffer()->fileName(); if (theBufferList().exists(filename.absFilename())) lyx_view_->setBuffer(theBufferList().getBuffer(filename.absFilename())); else - lyx_view_->loadLyXFile(filename); - // Set the parent name of the child document. - // This makes insertion of citations and references in the child work, - // when the target is in the parent or another child document. - lyx_view_->buffer()->setParentName(parentfilename); + if (lyx_view_->loadLyXFile(filename)) { + // Set the parent name of the child document. + // This makes insertion of citations and references in the child work, + // when the target is in the parent or another child document. + lyx_view_->buffer()->setParentName(parentfilename); + setMessage(bformat(_("Opening child document %1$s..."), + makeDisplayPath(filename.absFilename()))); + } else + setMessage(_("Document not loaded.")); break; } Index: src/insets/InsetInclude.cpp =================================================================== --- src/insets/InsetInclude.cpp (revision 18489) +++ src/insets/InsetInclude.cpp (working copy) @@ -393,12 +393,14 @@ if (!fs::exists(included_file.toFilesystemEncoding())) return false; buf = theBufferList().newBuffer(included_file.absFilename()); - if (!loadLyXFile(buf, included_file)) + if (!loadLyXFile(buf, included_file)) { + //close the buffer we just opened + theBufferList().close(buf, false); return false; + } } - if (buf) - buf->setParentName(parentFilename(buffer)); - return buf != 0; + buf->setParentName(parentFilename(buffer)); + return true; } @@ -420,7 +422,9 @@ //FIXME RECURSIVE INCLUDE //This isn't sufficient, as the inclusion could be downstream. //But it'll have to do for now. - if (!isListings(params_) && buffer.fileName() == included_file.toFilesystemEncoding()) { + if (!isListings(params_) && !isVerbatim(params_) && // not yet: + buffer.fileName() == included_file.toFilesystemEncoding()) + { Alert::error(_("Recursive input"), bformat(_("Attempted to include file %1$s in itself! " "Ignoring inclusion."), from_utf8(incfile))); @@ -439,8 +443,9 @@ // write it to a file (so far the complete file) string const exportfile = changeExtension(incfile, ".tex"); - string const mangled = DocFileName(changeExtension(included_file.absFilename(), - ".tex")).mangledFilename(); + string const mangled = + DocFileName(changeExtension(included_file.absFilename(),".tex")). + mangledFilename(); FileName const writefile(makeAbsPath(mangled, m_buffer->temppath())); if (!runparams.nice) @@ -451,8 +456,11 @@ if (runparams.inComment || runparams.dryrun) // Don't try to load or copy the file - ; - else if (loadIfNeeded(buffer, params_)) { + return true; + else if (isLyXFilename(included_file.absFilename())) { + if (!loadIfNeeded(buffer, params_)) + return false; + Buffer * tmp = theBufferList().getBuffer(included_file.absFilename()); if (tmp->params().textclass != m_buffer->params().textclass) {