diff options
-rw-r--r-- | gtk2_ardour/audio_streamview.cc | 10 | ||||
-rw-r--r-- | gtk2_ardour/audio_streamview.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_route_list.cc | 11 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/streamview.cc | 24 | ||||
-rw-r--r-- | gtk2_ardour/streamview.h | 4 | ||||
-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 |
9 files changed, 54 insertions, 23 deletions
diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index 279130ad38..35078804a2 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -279,9 +279,15 @@ AudioStreamView::playlist_modified () } void -AudioStreamView::playlist_changed (boost::shared_ptr<Diskstream> ds) +AudioStreamView::playlist_changed (boost::weak_ptr<Diskstream> wptr) { - ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::playlist_changed), ds)); + ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::playlist_changed), wptr)); + + boost::shared_ptr<Diskstream> ds = wptr.lock(); + + if (!ds) { + return; + } StreamView::playlist_changed(ds); diff --git a/gtk2_ardour/audio_streamview.h b/gtk2_ardour/audio_streamview.h index 12d400bebd..b2d538471f 100644 --- a/gtk2_ardour/audio_streamview.h +++ b/gtk2_ardour/audio_streamview.h @@ -91,7 +91,7 @@ class AudioStreamView : public StreamView void undisplay_diskstream (); void redisplay_diskstream (); void playlist_modified (); - void playlist_changed (boost::shared_ptr<ARDOUR::Diskstream>); + void playlist_changed (boost::weak_ptr<ARDOUR::Diskstream>); void add_crossfade (boost::shared_ptr<ARDOUR::Crossfade>); void add_crossfade_weak (boost::weak_ptr<ARDOUR::Crossfade>); diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index 1876b17f10..e2ed6f7191 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -133,24 +133,25 @@ Editor::remove_route (TimeAxisView *tv) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::remove_route), tv)); - TrackViewList::iterator i; TreeModel::Children rows = route_display_model->children(); TreeModel::Children::iterator ri; - if ((i = find (track_views.begin(), track_views.end(), tv)) != track_views.end()) { - track_views.erase (i); - } - for (ri = rows.begin(); ri != rows.end(); ++ri) { if ((*ri)[route_display_columns.tv] == tv) { route_display_model->erase (ri); break; } } + + if ((i = find (track_views.begin(), track_views.end(), tv)) != track_views.end()) { + track_views.erase (i); + } + /* since the editor mixer goes away when you remove a route, set the * button to inactive and untick the menu option */ + editor_mixer_button.set_active(false); ActionManager::uncheck_toggleaction ("<Actions>/Editor/show-editor-mixer"); diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index f14aa53e71..dd75113f68 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -296,7 +296,6 @@ RouteTimeAxisView::set_edit_group_from_menu (RouteGroup *eg) void RouteTimeAxisView::playlist_changed () - { label_view (); diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index 2a5c13a224..62d8e99254 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -194,11 +194,17 @@ StreamView::undisplay_diskstream () } void -StreamView::display_diskstream (boost::shared_ptr<Diskstream> ds) +StreamView::display_diskstream (boost::weak_ptr<Diskstream> wds) { + boost::shared_ptr<Diskstream> ds = wds.lock(); + + if (!ds) { + return; + } + playlist_change_connection.disconnect(); - playlist_changed (ds); - playlist_change_connection = ds->PlaylistChanged.connect (bind (mem_fun (*this, &StreamView::playlist_changed), ds)); + playlist_changed (wds); + playlist_change_connection = ds->PlaylistChanged.connect (bind (mem_fun (*this, &StreamView::playlist_changed), wds)); } void @@ -210,9 +216,15 @@ StreamView::playlist_modified () } void -StreamView::playlist_changed (boost::shared_ptr<Diskstream> ds) +StreamView::playlist_changed (boost::weak_ptr<Diskstream> wptr) { - ENSURE_GUI_THREAD (bind (mem_fun (*this, &StreamView::playlist_changed), ds)); + ENSURE_GUI_THREAD (bind (mem_fun (*this, &StreamView::playlist_changed), wptr)); + + boost::shared_ptr<Diskstream> ds = wptr.lock(); + + if (!ds) { + return; + } /* disconnect from old playlist */ @@ -238,7 +250,7 @@ StreamView::diskstream_changed () Track *t; if ((t = _trackview.track()) != 0) { - Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun (*this, &StreamView::display_diskstream), t->diskstream())); + Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun (*this, &StreamView::display_diskstream), boost::weak_ptr<Diskstream> (t->diskstream()))); } else { Gtkmm2ext::UI::instance()->call_slot (mem_fun (*this, &StreamView::undisplay_diskstream)); } diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h index 657bfa9044..ef55ebc4af 100644 --- a/gtk2_ardour/streamview.h +++ b/gtk2_ardour/streamview.h @@ -111,12 +111,12 @@ protected: virtual void remove_region_view (boost::weak_ptr<ARDOUR::Region> ); //void remove_rec_region (boost::shared_ptr<ARDOUR::Region>); (unused) - void display_diskstream (boost::shared_ptr<ARDOUR::Diskstream>); + void display_diskstream (boost::weak_ptr<ARDOUR::Diskstream>); virtual void undisplay_diskstream (); virtual void redisplay_diskstream () = 0; void diskstream_changed (); - virtual void playlist_changed (boost::shared_ptr<ARDOUR::Diskstream>); + virtual void playlist_changed (boost::weak_ptr<ARDOUR::Diskstream>); virtual void playlist_modified (); virtual void color_handler (ColorID, uint32_t) = 0; 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 |