From a1932c7feba446dc0168d200d7f6808c39046962 Mon Sep 17 00:00:00 2001 From: John Emmas Date: Fri, 19 Jun 2015 12:55:38 +0100 Subject: [PATCH] Correctly re-start an iteration (if we delete one of the items being iterated) --- libs/canvas/wave_view.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/canvas/wave_view.cc b/libs/canvas/wave_view.cc index 52f6ee9f33..55f5f0befe 100644 --- a/libs/canvas/wave_view.cc +++ b/libs/canvas/wave_view.cc @@ -1637,8 +1637,11 @@ WaveViewCache::consolidate_image_cache (boost::shared_ptr s if (e2->start >= e1->start && e2->end <= e1->end) { /* c2 is fully contained by c1, so delete it */ - c2 = caches.erase (c2); - continue; + caches.erase (c2); + + /* and re-start the whole iteration */ + nxt = caches.begin (); + break; } c2 = nxt2;