gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-commit] gnash ChangeLog server/dlist.cpp server/dlist.h...


From: strk
Subject: Re: [Gnash-commit] gnash ChangeLog server/dlist.cpp server/dlist.h...
Date: Mon, 3 Dec 2007 08:33:30 +0100

On Mon, Dec 03, 2007 at 07:06:15AM +0000, Zou Lunkai wrote:

> +void
> +DisplayList::mergeDisplayList(DisplayList & newList)
> +{
> +     testInvariant();
> +
> +     iterator itOld = beginNonRemoved(_charsByDepth);
> +     iterator itNew = beginNonRemoved(newList._charsByDepth);
> +
> +     iterator itOldEnd = staticZoneEnd(_charsByDepth);
> +     iterator itNewEnd = staticZoneEnd(newList._charsByDepth); 
> +
> +     while( itOld != itOldEnd )
> +     {
...
> +             while( itNew != itNewEnd )
> +             {
...
> +                             _charsByDepth.erase(itOldBack);

I'm not sure it is safe to use itOldBack again after this erase
(it' used as the while condition)

> +                                     // replace the old character with the 
> character in the new depth
> +                                     _charsByDepth.insert(itOldBack, 
> *itNewBack);
> +                                     _charsByDepth.erase(itOldBack);

Same here, both insert and erase would make itOldBack not point to the end 
anymore.

> +                                     newList._charsByDepth.erase(itNewBack);

This would apply to itNewBack...

> +                             _charsByDepth.insert(itOldBack, *itNewBack );

and here.

> +     // unload remaining characters in old list
> +     while( itOld != itOldEnd )
> +     {

What would itOldEnd point to after all possible modifications above ?

> +     // add remaining characters in new list to the old list
> +     if( itNew != itNewEnd )
> +     {

Same here...

--strk;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]