diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-05-18 16:52:50 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-05-18 16:52:50 +0000 |
commit | ead3796adeed06a7d314317d3ca65861409eebda (patch) | |
tree | 5095c682c12e003d98fa8e591a72afbb70921376 /libs/ardour/session.cc | |
parent | dcaa9cd70d04c8f6eb63c814068c9fa5a60adc7e (diff) |
allow diskstream deletion after a track is removed by using weak_ptr<Diskstream> instead of shared_ptr<Diskstream> in GUI signal handling
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@1883 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r-- | libs/ardour/session.cc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index d3b65210a4..c2c21a631d 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -986,8 +986,15 @@ Session::playlist_length_changed () } void -Session::diskstream_playlist_changed (boost::shared_ptr<Diskstream> dstream) +Session::diskstream_playlist_changed (boost::weak_ptr<Diskstream> wptr) { + boost::shared_ptr<Diskstream> dstream = wptr.lock(); + + if (!dstream) { + return; + + } + boost::shared_ptr<Playlist> playlist; if ((playlist = dstream->playlist()) != 0) { @@ -2019,12 +2026,12 @@ Session::add_diskstream (boost::shared_ptr<Diskstream> dstream) /* writer goes out of scope, copies ds back to main */ } - dstream->PlaylistChanged.connect (sigc::bind (mem_fun (*this, &Session::diskstream_playlist_changed), dstream)); + dstream->PlaylistChanged.connect (sigc::bind (mem_fun (*this, &Session::diskstream_playlist_changed), + boost::weak_ptr<Diskstream> (dstream))); /* this will connect to future changes, and check the current length */ diskstream_playlist_changed (dstream); dstream->prepare (); - } void @@ -2077,6 +2084,8 @@ Session::remove_route (shared_ptr<Route> route) boost::shared_ptr<DiskstreamList> d = dsl.get_copy(); d->remove (ds); } + + diskstreams.flush (); } find_current_end (); @@ -2085,8 +2094,9 @@ Session::remove_route (shared_ptr<Route> route) set_dirty(); // We need to disconnect the routes inputs and outputs - route->disconnect_inputs(NULL); - route->disconnect_outputs(NULL); + + route->disconnect_inputs (0); + route->disconnect_outputs (0); /* get rid of it from the dead wood collection in the route list manager */ |