alternative fix for the same problem that 9e2048decf7c567 was addressing
[ardour.git] / libs / ardour / session_state.cc
index 6dc5462d58814f4b2a4839df0e9e0224026f9490..0edff32535380d7392c2ca31e4cab9fc52838cb1 100644 (file)
@@ -2888,20 +2888,19 @@ 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);
                                        
                                        // also remove source from all_sources
                                        
                                        for (set<string>::iterator j = all_sources.begin(); j != all_sources.end(); ++j) {
                                                spath = Glib::path_get_basename (*j);
-                                               if ( spath == fpath ) {
+                                               if (spath == i->second->name()) {
                                                        all_sources.erase (j);
                                                        break;
                                                }
                                        }
+
+                                       sources.erase (i);
                                }
                        }
                }