From 9e2048decf7c5671e611fb6239b9b73b2c68d2d5 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 2 Jul 2015 19:46:38 +0200 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20use=20invalid=20iterator=20duri?= =?UTF-8?q?ng=20cleanup.=20fixes=20#6403?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/ardour/session_state.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index a921747ac2..6dc5462d58 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -2888,6 +2888,8 @@ Session::cleanup_sources (CleanupReport& rep) in the region list. */ + std::string fpath = i->second->name (); + RegionFactory::remove_regions_using_source (i->second); sources.erase (i); @@ -2895,7 +2897,7 @@ Session::cleanup_sources (CleanupReport& rep) for (set::iterator j = all_sources.begin(); j != all_sources.end(); ++j) { spath = Glib::path_get_basename (*j); - if ( spath == i->second->name () ) { + if ( spath == fpath ) { all_sources.erase (j); break; }