Re: lists bug


Subject: Re: lists bug
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Wed Nov 22 2000 - 05:18:53 CST


HI Mike,
        Thanks for finding the cause of the assert. The fix is really
simple. Just add the code:

        if( m_pItems.getItemCount() == 0)
               return;

Immediately before:

         PL_StruxDocHandle pCurFirst = (PL_StruxDocHandle) m_pItems.getFirstItem();
         if(pCurFirst == NULL)
               return;

In fl_AutoNum::findAndSetParentItem(void)

And all will be well. This method is called on every list update so an
empty list will always give the assert. It's not dangerous.

Do the same for getFirstItem(), make sure to return a NULL if the vector
is empty. It's defined in fl_AutoNum.h. You might want to move the code
into the *.cpp. I'm not a fan of writing functions in headers anyway. I
blame Luke for that one!

I know what you mean about bugs in the List code. This has been a long
hard slog but I believe it will be worth it. I really think we're doing
better in many ways than MS Word here. MS wimps out when it comes to
cutting lists. They leave the list labels in place and you have to delete
them one by one. I guess they couldn't get undo to work otherwise. We
will :-)

Anyway, after these, are we almost there yet?

Cheers

Martin

 On Wed, 22 Nov 2000, Mike Nordell wrote:

> While trying to get the lists dialog going I've encountered some more
> problems in the current code.
>
> fl_AutoNum::update() calls getFirstItem(), and that one asserts since the
> UT_Vector is empty.
>
> The call stack is like
> fl_AutoNum::update()
> fl_AutoNum::update()
> fl_BlockLayout::listUpdate()
>
> While browsing the code I also found at least one place
> (fl_AutoNum::findAndSetParentItem) where the assumption _might_ be that the
> vector returns zero if it doesn't have the item. The list I tried it on was
> a bullet list.
>
> Any ideas, insights or plain flames for even finding these little buggers
> (and probably delaying 0.7.12 even more) would be appreciated. :-)
>
> /Mike
>
>
>



This archive was generated by hypermail 2b25 : Wed Nov 22 2000 - 05:19:15 CST