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;


_______________________________________________
Gnash-commit mailing list
Gnash-commit@gnu.org
http://lists.gnu.org/mailman/listinfo/gnash-commit

Reply via email to