From: fred Date: Fri, 11 Oct 1996 17:02:43 +0000 (+0000) Subject: flower-1.0.2 X-Git-Tag: release/1.5.59~7097 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2dcc8162575a6e6d99cdfa7c62f17ea0f8e6e7d1;p=lilypond.git flower-1.0.2 --- diff --git a/flower/list.inl b/flower/list.inl index 54df457481..8396156b6a 100644 --- a/flower/list.inl +++ b/flower/list.inl @@ -22,8 +22,12 @@ template inline List::~List() { - for ( Cursor c( *this ); c.forward(); c++ ) - remove( c ); + Cursor next(*this); + for ( Cursor c( *this ); c.ok(); c = next ) { + next = c; + next++; + remove( c ); + } } template @@ -94,12 +98,12 @@ template inline void List::remove( Cursor me ) { - if ( me.ok() ) - { - me.pointer()->remove(*this); - delete me.pointer(); + if ( me.ok() ){ + Link *lp = me.pointer(); + lp->remove(*this); + delete lp; size_--; - } + } } template @@ -127,8 +131,12 @@ template inline PointerList::~PointerList() { - for ( Cursor c( *this ); c.forward(); c++ ) - remove( c ); + Cursor next(*this); + for ( Cursor c( *this ); c.ok(); c = next ) { + next = c; + next++; + remove( c ); // PointerList::remove deletes the real data + } } template @@ -136,7 +144,7 @@ inline void PointerList_print( PointerList const & l ) { List& promises_to_be_const = (List&) l; - for ( Cursor c( promises_to_be_const ); c.forward(); c++ ) + for ( Cursor c( promises_to_be_const ); c.ok(); c++ ) (*c)->print(); }