>>>>> "Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:

Abdelrazak> Hello, Two files with this mail:

Abdelrazak> RandomAccessList.h: renamed and cleaned up version of
Abdelrazak> former it_vector.h ParagraphListRewrite.patch: updated
Abdelrazak> with the above.

Abdelrazak> I think that I took into account most if not all issues
Abdelrazak> pointed by Lars and Angus. I have tested this pretty
Abdelrazak> extensively.

I tried it out, and as you suspected it crashes when doing latex
export. The assertion I get is:

/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.1/../../../../include/c++/3.4.1/debug/safe_iterator.h:207:
    error: attempt to increment a past-the-end iterator.

Objects involved in the operation:
iterator "this" @ 0x0xbfffd710 {
type = 
N11__gnu_debug14_Safe_iteratorIN10__gnu_norm20_List_const_iteratorI9ParagraphEEN15__gnu_debug_def4listIS3_SaIS3_EEEEE
 (constant iterator);
  state = past-the-end;
  references sequence with type `N15__gnu_debug_def4listI9ParagraphSaIS1_EEE' @ 
0x0xbfffd710
}

and it happens in TeXOnePar:

#7  0x08271f32 in RandomAccessList<Paragraph>::const_iterator::operator- (
    this=0xbfffda40) at ../../../lyx-devel/src/insets/insetcharstyle.C:292
#8  0x08273f9b in (anonymous namespace)::TeXOnePar ([EMAIL PROTECTED],
    [EMAIL PROTECTED], pit=
          
{<__gnu_debug::_Safe_iterator<__gnu_norm::_List_const_iterator<Paragraph>,__gnu_debug_def::list<Paragraph,
 std::allocator<Paragraph> > >> = {<__gnu_debug::_Safe_iterator_base> = 
{_M_sequence = 0x887fbd0, _M_version = 1, _M_prior = 0xbfffd8a0, _M_next = 
0xbfffda80}, _M_current = {_M_node = 0x8891588}}, <No data fields>}, [EMAIL 
PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],
    [EMAIL PROTECTED]) at ../../lyx-devel/src/output_latex.C:335

The relevant code is:

        bool need_par = pit->simpleTeXOnePar(buf, bparams,
                        outerFont(pit - paragraphs.begin(), paragraphs),
                                             os, texrow, runparams);

It transpires that at this point "pit - paragraphs.begin()" crashes,
because the std::distance algorithm fails to find pit from begin().

One thing I wonder about is whether your operator= for iterators works
correctly. There is several instances of code like

        ParagraphList::const_iterator par = pit;
        do {
                par = TeXOnePar(buf, paragraphs, par, os, texrow, runparams);

Where par is passed by value to TeXOnePar. Is your code prepared to
that?

JMarc

Reply via email to