Fix list corruption in insert_time and fix sort(), too

This commit is contained in:
Robert Wruck 2011-06-21 21:58:15 -07:00 committed by Jonathan Moore Liles
parent ba94d2c354
commit c7a54f2c4d
1 changed files with 8 additions and 1 deletions

View File

@ -495,6 +495,8 @@ event_list::insert_time ( tick_t start, tick_t l )
e->timestamp( e->timestamp() + l ); e->timestamp( e->timestamp() + l );
} }
} }
sort();
} }
/** delete events in range and close the gap */ /** delete events in range and close the gap */
@ -550,14 +552,19 @@ event_list::sort ( event *e )
void void
event_list::sort ( void ) event_list::sort ( void )
{ {
event_list *temp = new event_list( *this ); event_list *temp = new event_list( );
_head = temp->_head; _head = temp->_head;
_tail = temp->_tail; _tail = temp->_tail;
FOR_ALL( n )
temp->insert( n );
temp->_head = NULL; temp->_head = NULL;
delete temp; delete temp;
relink();
} }
/** move event /e/ by /o/ ticks */ /** move event /e/ by /o/ ticks */