]> git.lyx.org Git - features.git/commitdiff
Create a new DocumentClass for any cloned Buffer.
authorRichard Heck <rgheck@lyx.org>
Mon, 11 Mar 2013 14:01:32 +0000 (10:01 -0400)
committerRichard Heck <rgheck@lyx.org>
Wed, 27 Mar 2013 20:21:50 +0000 (16:21 -0400)
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
status.20x

index 40e650c6323f46ec6b287725c5bad8b9da3ec511..8dc13c33204dd7c4ca84ca793eb66b14bf2dc102 100644 (file)
@@ -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<InsetText &>(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<InsetText &>(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;
index 457045b3569d6417572d08c58764d3b7172df308..c8520edf888de29f158b46b9d3804e662339067d 100644 (file)
@@ -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