From 36bec04a13ddf3884abc70eaa33f59a331c63722 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Mon, 11 Mar 2013 10:01:32 -0400 Subject: [PATCH] Create a new DocumentClass for any cloned Buffer. Uwe says that this fixes #8425. This has been in trunk for two weeks without problems. Hopefully, that means it is safe. (cherry picked from commit e2155d3d580d2849f7861040d71be8b24a582839) Conflicts: src/Buffer.cpp --- src/Buffer.cpp | 22 ++++++++++++++++++++++ status.20x | 7 +++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 40e650c632..8dc13c3320 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -24,6 +24,8 @@ #include "Chktex.h" #include "Converter.h" #include "Counters.h" +#include "Cursor.h" +#include "CutAndPaste.h" #include "DispatchResult.h" #include "DocIterator.h" #include "Encoding.h" @@ -510,11 +512,21 @@ void Buffer::cloneWithChildren(BufferMap & bufmap, CloneList * clones) const return; Buffer * buffer_clone = new Buffer(fileName().absFileName(), false, this); + + // The clone needs its own DocumentClass, since running updateBuffer() will + // modify it, and we would otherwise be sharing it with the original Buffer. + buffer_clone->params().makeDocumentClass(); + ErrorList el; + cap::switchBetweenClasses( + params().documentClassPtr(), buffer_clone->params().documentClassPtr(), + static_cast(buffer_clone->inset()), el); + bufmap[this] = buffer_clone; clones->insert(buffer_clone); buffer_clone->d->clone_list_ = clones; buffer_clone->d->macro_lock = true; buffer_clone->d->children_positions.clear(); + // FIXME (Abdel 09/01/2010): this is too complicated. The whole children_positions and // math macro caches need to be rethought and simplified. // I am not sure wether we should handle Buffer cloning here or in BufferList. @@ -548,8 +560,18 @@ Buffer * Buffer::cloneBufferOnly() const { cloned_buffers.push_back(new CloneList()); CloneList * clones = cloned_buffers.back(); Buffer * buffer_clone = new Buffer(fileName().absFileName(), false, this); + + // The clone needs its own DocumentClass, since running updateBuffer() will + // modify it, and we would otherwise be sharing it with the original Buffer. + buffer_clone->params().makeDocumentClass(); + ErrorList el; + cap::switchBetweenClasses( + params().documentClassPtr(), buffer_clone->params().documentClassPtr(), + static_cast(buffer_clone->inset()), el); + clones->insert(buffer_clone); buffer_clone->d->clone_list_ = clones; + // we won't be cloning the children buffer_clone->d->children_positions.clear(); return buffer_clone; diff --git a/status.20x b/status.20x index 457045b356..c8520edf88 100644 --- a/status.20x +++ b/status.20x @@ -69,6 +69,9 @@ What's new * DOCUMENT INPUT/OUTPUT +- Fixed occasional crash when exporting a document while View>Source is + open and being updated (bug). + - Load the babel package also if the document is English-only (bug 8423). - Fix call of nonsense font packages in some localizations. @@ -91,8 +94,6 @@ What's new - When using the knitr module, use new "encoding" parameter of knitr if available (bug 8504). -- Respect InsetLayout's PassThru setting for XHTML export. - - Fix layout conversion bug involving quoted Flex inset names that do not contain spaces. @@ -188,6 +189,8 @@ What's new - Clean ids for citations before outputting them. Characters like ":" are not allowed in HTML identifiers, apparently (bug 8606). +- Respect InsetLayout's PassThru setting for XHTML export. + * TEX2LYX -- 2.39.5