Table cells are insets, but not from the point of view of DocIterators

and Cursors. So just calling InsetText::addToToc for the cells causes
problems, because InsetText::addToToc then adds the cell inset itself
as part of the DocIterator. This then leads to assertions, such as bug

The solution is to refactor InsetText::addToToc so that we can call the
iterating part without adding the inset.
(cherry picked from commit 6a85db2307)
This commit is contained in:
Richard Heck 2014-02-24 14:36:13 -05:00
parent c7596ec4b2
commit 4277e8b733
5 changed files with 19 additions and 0 deletions

View File

@ -3373,6 +3373,12 @@ docstring InsetTableCell::asString(bool intoInsets)
}
void InsetTableCell::addToToc(DocIterator const & di, bool output_active) const
{
InsetText::iterateForToc(di, output_active);
}
docstring InsetTableCell::xhtml(XHTMLStream & xs, OutputParams const & rp) const
{
if (!isFixedWidth)

View File

@ -68,6 +68,8 @@ public:
docstring asString(bool intoInsets = true);
///
docstring xhtml(XHTMLStream &, OutputParams const &) const;
///
void addToToc(DocIterator const & di, bool output_active) const;
private:
/// unimplemented
InsetTableCell();

View File

@ -727,6 +727,13 @@ void InsetText::addToToc(DocIterator const & cdit) const
{
DocIterator dit = cdit;
dit.push_back(CursorSlice(const_cast<InsetText &>(*this)));
iterateForToc(dit, output_active);
}
void InsetText::iterateForToc(DocIterator const & cdit, bool output_active) const
{
DocIterator dit = cdit;
Toc & toc = buffer().tocBackend().toc("tableofcontents");
BufferParams const & bufparams = buffer_->params();

View File

@ -215,6 +215,8 @@ protected:
docstring getCaptionText(OutputParams const &) const;
///
docstring getCaptionHTML(OutputParams const &) const;
///
void iterateForToc(DocIterator const & cdit, bool output_active) const;
private:
///
bool drawFrame_;

View File

@ -73,6 +73,8 @@ What's new
- Fix outliner-related crash when master and child are open in different
windows (bug 8948).
- Fix outliner-related crash involving captions in long tables (bug 8997).
- Fix hang when using BibTeX files with really long author lists (bug 8944).
- Fix crash with changetracking in bibliography environment (bug 8646).