diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-10-02 18:09:34 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-10-02 18:09:34 +0000 |
commit | 02115563feabd8d0019bfda605c88552c24f0890 (patch) | |
tree | bd056b5118f4313364e64062ecbfa5a05f484d2f /libs | |
parent | 0b6139304ba628d63bfcad3a868fd5757bb6478c (diff) |
fixes for various bugs including dangling ref to route in session, opening sessions from the NSD, closing a session leaving dangling pointers etc etc
git-svn-id: svn://localhost/ardour2/trunk@938 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/session.h | 2 | ||||
-rw-r--r-- | libs/ardour/audio_diskstream.cc | 2 | ||||
-rw-r--r-- | libs/ardour/audiofilesource.cc | 1 | ||||
-rw-r--r-- | libs/ardour/session.cc | 34 |
4 files changed, 27 insertions, 12 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index f6d5e9cc8d..79fd442995 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1419,7 +1419,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible bool currently_soloing; void route_mute_changed (void *src); - void route_solo_changed (void *src, boost::shared_ptr<Route>); + void route_solo_changed (void *src, boost::weak_ptr<Route>); void catch_up_on_solo (); void update_route_solo_state (); void modify_solo_mute (bool, bool); diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 71d16583e0..89bffc89e3 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -1967,8 +1967,6 @@ AudioDiskstream::reset_write_sources (bool mark_write_complete, bool force) ChannelList::iterator chan; uint32_t n; - cerr << _name << " RWS\n"; - if (!recordable()) { return; } diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index dfc07de787..9564fff53b 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -101,7 +101,6 @@ AudioFileSource::AudioFileSource (Session& s, const XMLNode& node) AudioFileSource::~AudioFileSource () { if (removable()) { - cerr << "Removing file " << _path << " because its removable\n"; unlink (_path.c_str()); unlink (peakpath.c_str()); } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 057774b49c..bf5f5fcb78 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1825,7 +1825,10 @@ Session::add_routes (RouteList& new_routes, bool save) } for (RouteList::iterator x = new_routes.begin(); x != new_routes.end(); ++x) { - (*x)->solo_changed.connect (sigc::bind (mem_fun (*this, &Session::route_solo_changed), (*x))); + + boost::weak_ptr<Route> wpr (*x); + + (*x)->solo_changed.connect (sigc::bind (mem_fun (*this, &Session::route_solo_changed), wpr)); (*x)->mute_changed.connect (mem_fun (*this, &Session::route_mute_changed)); (*x)->output_changed.connect (mem_fun (*this, &Session::set_worst_io_latencies_x)); (*x)->redirects_changed.connect (mem_fun (*this, &Session::update_latency_compensation_proxy)); @@ -1883,11 +1886,11 @@ Session::remove_route (shared_ptr<Route> route) */ if (route == _master_out) { - _master_out = shared_ptr<Route> ((Route*) 0); + _master_out = shared_ptr<Route> (); } if (route == _control_out) { - _control_out = shared_ptr<Route> ((Route*) 0); + _control_out = shared_ptr<Route> (); /* cancel control outs for all routes */ @@ -1925,13 +1928,21 @@ Session::remove_route (shared_ptr<Route> route) update_latency_compensation (false, false); set_dirty(); - /* XXX should we disconnect from the Route's signals ? */ + /* get rid of it from the dead wood collection in the route list manager */ + + /* XXX i think this is unsafe as it currently stands, but i am not sure. (pd, october 2nd, 2006) */ - save_state (_current_snapshot_name); + routes.flush (); /* try to cause everyone to drop their references */ route->drop_references (); + + /* save the new state of the world */ + + if (save_state (_current_snapshot_name)) { + save_history (_current_snapshot_name); + } } void @@ -1941,7 +1952,7 @@ Session::route_mute_changed (void* src) } void -Session::route_solo_changed (void* src, shared_ptr<Route> route) +Session::route_solo_changed (void* src, boost::weak_ptr<Route> wpr) { if (solo_update_disabled) { // We know already @@ -1949,8 +1960,15 @@ Session::route_solo_changed (void* src, shared_ptr<Route> route) } bool is_track; - - is_track = (dynamic_cast<AudioTrack*>(route.get()) != 0); + boost::shared_ptr<Route> route = wpr.lock (); + + if (!route) { + /* should not happen */ + error << string_compose (_("programming error: %1"), X_("invalid route weak ptr passed to route_solo_changed")) << endmsg; + return; + } + + is_track = (boost::dynamic_pointer_cast<AudioTrack>(route) != 0); shared_ptr<RouteList> r = routes.reader (); |