From efacbb1485116a307145f71853062d9d1e722dc6 Mon Sep 17 00:00:00 2001 From: nick_m Date: Fri, 23 Dec 2016 23:03:22 +1100 Subject: [PATCH] possibly faster way to clear ghost events. --- gtk2_ardour/ghostregion.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc index d76abd6659..e95a2b4950 100644 --- a/gtk2_ardour/ghostregion.cc +++ b/gtk2_ardour/ghostregion.cc @@ -356,11 +356,14 @@ MidiGhostRegion::add_note (NoteBase* n) void MidiGhostRegion::clear_events() { - for (EventList::iterator it = events.begin(); it != events.end(); ++it) { + EventList::iterator it = events.begin(); + + while (it != events.end()) { delete (*it).second; + events.erase (it); + ++it; } - events.clear(); _optimization_iterator = events.end (); }