Author: rgheck
Date: Thu May 26 16:16:52 2011
New Revision: 38842
URL: http://www.lyx.org/trac/changeset/38842
Log:
Fix bug reported on user list. Children included more than once in
the same document could not be rendered.
Problem was that we were using children_positions to deal with the
included documents. That structure only includes each child once.
We need to use position_to_children, instead.
Modified:
lyx-devel/trunk/src/Buffer.cpp
Modified: lyx-devel/trunk/src/Buffer.cpp
==============================================================================
--- lyx-devel/trunk/src/Buffer.cpp Thu May 26 15:59:23 2011 (r38841)
+++ lyx-devel/trunk/src/Buffer.cpp Thu May 26 16:16:52 2011 (r38842)
@@ -449,12 +449,12 @@
// math macro caches need to be rethought and simplified.
// I am not sure wether we should handle Buffer cloning here or in
BufferList.
// Right now BufferList knows nothing about buffer clones.
- Impl::BufferPositionMap::iterator it = d->children_positions.begin();
- Impl::BufferPositionMap::iterator end = d->children_positions.end();
+ Impl::PositionScopeBufferMap::iterator it =
d->position_to_children.begin();
+ Impl::PositionScopeBufferMap::iterator end =
d->position_to_children.end();
for (; it != end; ++it) {
- DocIterator dit = it->second.clone(buffer_clone);
+ DocIterator dit = it->first.clone(buffer_clone);
dit.setBuffer(buffer_clone);
- Buffer * child = const_cast<Buffer *>(it->first);
+ Buffer * child = const_cast<Buffer *>(it->second.second);
child->clone(bufmap);
BufferMap::iterator const bit = bufmap.find(child);
@@ -466,6 +466,7 @@
InsetInclude * inset_inc = static_cast<InsetInclude *>(inset);
inset_inc->setChildBuffer(child_clone);
child_clone->d->setParent(buffer_clone);
+ // FIXME Do we need to do this now, or can we wait until we run
updateMacros()?
buffer_clone->setChild(dit, child_clone);
}
buffer_clone->d->macro_lock = false;