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 | |
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')
-rw-r--r-- | libs/ardour/ardour/session.h | 2 | ||||
-rw-r--r-- | libs/ardour/session.cc | 20 | ||||
-rw-r--r-- | libs/ardour/track.cc | 3 |
3 files changed, 19 insertions, 6 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 70a9d7c96f..fb7d24568f 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1497,7 +1497,7 @@ class Session : public PBD::StatefulDestructible boost::shared_ptr<Playlist> XMLPlaylistFactory (const XMLNode&); void playlist_length_changed (); - void diskstream_playlist_changed (boost::shared_ptr<Diskstream>); + void diskstream_playlist_changed (boost::weak_ptr<Diskstream>); /* NAMED SELECTIONS */ 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 */ diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 95e21e6735..e9b16b137c 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -60,6 +60,9 @@ Track::Track (Session& sess, const XMLNode& node, DataType default_type) Track::~Track () { + if (_diskstream) { + _diskstream->drop_references (); + } } void |