List function erase is dangerous

Bug #398628 reported by Iyer Arvind Sundaram
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
कर्म
Fix Committed
Wishlist
Prasad H L Bhat

Bug Description

List function erase removes the iterator passed to it. This means any operation of erase in a iterator loop, will immediately cause an error because 'i' would be freed and one would perform 'i++', where i is the iterator. A better solution would be to return the next iterator, so that one can do i=list.erase(i), or take i be reference and increment it (decrement in the case of the last element)

Changed in project-karma:
assignee: nobody → H. L. Prasad (hlprasu)
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Prasad H L Bhat (hlprasu) wrote :

The code is now fixed according to this wish list.

Changed in project-karma:
status: Confirmed → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.