Re: PieceTables? Hmm...

Jeff Hostetler (jeff@abisource.com)
Sun, 25 Apr 1999 07:31:47 -0500


Jeff Hostetler wrote:
> Matt Kimball wrote:
> > So, after playing with it a bit, I found a reliable way to crash it:
> >
> > 1. Start up AbiWord
> > 2. Type Alt-Enter, Backspace, Delete
> >
> > ...
> > pointer updated when this happends, so we get a block with a stale
> > m_pSectionLayout pointer.
>
> yes that looks to be the problem. BTW there's a Test_Dump method that
> will (in 0.5.4 and earlier) dump the contents of the piece table to a
> file (dump.ptbl.%d). in the current CVS view and in the upcomming 0.5.5
> it will also dump the contents of the format/layout (dump.fmt.%d). these
> will either be in your current directory or in the exe directory. check
> src/wp/ap/xp/ap_LB_Default.cpp for the key/mouse binding in your view of
> the src. it's probably worth the effort to do a CVS update to get my
> latest enhancements to the debug info....
>
> > So I trace through the code in the src/text tree for a while and look
> > at all that it does, but there is a lot going on, and a lot of it
> > isn't immediately obvious and isn't documented. So, I'm not very
> > clear on what exactly should be updating the stale pointer.

> i'm thinking that the backspace operation should have deleted both
> the section and the block rather than just the second section. that
> is after the backspace the dump should (give or take a pointer value)
> look like the first dump.

after i sent this i remembered that i had put in code to silently
convert a 'delete first block in section' to a 'delete the section
and let blocks be assimilated by previous section'. so please disregard
this suggestion. cursor motion and editing operations around section
breaks are probably a little ambiguous/arbitrary until we get "show-invisibles"
working....

> i'm going to hold off on tracking this down myself ....

i tried, really i tried, i tried not to just go find it and kill it -- i
managed to wait all of an hour or so before the unseen forces pulled me
back to the keyboard....

in fl_DocSectionLayout::doclistener_deleteStrux() there's a loop which moves
blocks from one section to another (calling removeBlock() and addBlock()).
it looks like fl_SectionLayout::addBlock() should set the pointer in the
block (looks like we need another method on fl_BlockLayout to do this for us)
and (to be safe) removeBlock() should probably clear it. (i haven't tested
this, but it appears that fl_SectionLayout::insertBlock() method does cause
it to be set via the fl_BlockLayout constructor, so i think that's right.)

jeff



This archive was generated by hypermail 1.03b2.