diff options
author | Carl Hetherington <carl@carlh.net> | 2011-03-02 11:30:37 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-03-02 11:30:37 +0000 |
commit | fa41cfef580b2c8c04adec5b47d6cfa415ca6251 (patch) | |
tree | c227d9a12f5b22f685e2a7f2b74fb3cc06d7415f | |
parent | 865f4db12ea5fe4897a6e5399f0397d9325c0763 (diff) |
Less subtle attempt to prevent crashes on removing sources during session deletion.
git-svn-id: svn://localhost/ardour2/branches/3.0@9028 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | libs/ardour/session.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 63f5dc8e43..c554996a49 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -302,15 +302,9 @@ Session::destroy () routes.flush (); DEBUG_TRACE (DEBUG::Destruction, "delete sources\n"); - for (SourceMap::iterator i = sources.begin(); i != sources.end(); ) { - - SourceMap::iterator j = i; - ++j; - + for (SourceMap::iterator i = sources.begin(); i != sources.end(); ++i) { DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for source %1 ; pre-ref = %2\n", i->second->path(), i->second.use_count())); i->second->drop_references (); - - i = j; } sources.clear (); @@ -2697,6 +2691,10 @@ Session::add_source (boost::shared_ptr<Source> source) void Session::remove_source (boost::weak_ptr<Source> src) { + if (_state_of_the_state & Deletion) { + return; + } + SourceMap::iterator i; boost::shared_ptr<Source> source = src.lock(); @@ -2708,7 +2706,6 @@ Session::remove_source (boost::weak_ptr<Source> src) Glib::Mutex::Lock lm (source_lock); if ((i = sources.find (source->id())) != sources.end()) { - cerr << "Removing source " << source->name() << endl; sources.erase (i); } } |