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 e2155d3d58)

Conflicts:
	src/Buffer.cpp
This commit is contained in:
Richard Heck 2013-03-11 10:01:32 -04:00
parent 340529920e
commit 36bec04a13
2 changed files with 27 additions and 2 deletions

View 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;

View 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