diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 14eecbae6a..9326c9b948 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -805,7 +805,7 @@ public: int cleanup_sources (CleanupReport&); int cleanup_trash_sources (CleanupReport&); - int destroy_sources (std::list >); + int destroy_sources (std::list > const&); int remove_last_capture (); void get_last_capture_sources (std::list >&); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 09e5634f5e..499cf73379 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -4242,11 +4242,11 @@ Session::find_whole_file_parent (boost::shared_ptr child) const } int -Session::destroy_sources (list > srcs) +Session::destroy_sources (list > const& srcs) { set > relevant_regions; - for (list >::iterator s = srcs.begin(); s != srcs.end(); ++s) { + for (list >::const_iterator s = srcs.begin(); s != srcs.end(); ++s) { RegionFactory::get_regions_using_source (*s, relevant_regions); } @@ -4267,7 +4267,7 @@ Session::destroy_sources (list > srcs) r = tmp; } - for (list >::iterator s = srcs.begin(); s != srcs.end(); ) { + for (list >::const_iterator s = srcs.begin(); s != srcs.end(); ++s) { { Glib::Threads::Mutex::Lock ls (source_lock); @@ -4278,8 +4278,6 @@ Session::destroy_sources (list > srcs) (*s)->mark_for_remove (); (*s)->drop_references (); SourceRemoved(*s); - - s = srcs.erase (s); } return 0;