X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=gtk2_ardour%2Froute_processor_selection.cc;h=b3a6620f6bf1bca3f56fea40f7c90d7857ae642b;hb=04150d80698c8756dd669b28627c53cc753e1c40;hp=dfc345f63e377ce061e3fd7bb9e334a0f62a77b4;hpb=bb9cc45cd22af67ac275a5e73accbe14fee664d8;p=ardour.git diff --git a/gtk2_ardour/route_processor_selection.cc b/gtk2_ardour/route_processor_selection.cc index dfc345f63e..b3a6620f6b 100644 --- a/gtk2_ardour/route_processor_selection.cc +++ b/gtk2_ardour/route_processor_selection.cc @@ -26,13 +26,13 @@ #include "ardour/route.h" #include "route_processor_selection.h" +#include "gui_thread.h" #include "i18n.h" using namespace std; using namespace ARDOUR; using namespace PBD; -using namespace sigc; RouteRedirectSelection& RouteRedirectSelection::operator= (const RouteRedirectSelection& other) @@ -69,6 +69,7 @@ void RouteRedirectSelection::clear_routes () { routes.clear (); + drop_connections (); RoutesChanged (); } @@ -93,18 +94,28 @@ RouteRedirectSelection::add (boost::shared_ptr r) { if (find (routes.begin(), routes.end(), r) == routes.end()) { routes.push_back (r); + r->DropReferences.connect (*this, MISSING_INVALIDATOR, boost::bind (&RouteRedirectSelection::removed, this, boost::weak_ptr(r)), gui_context()); + RoutesChanged(); + } +} - // XXX SHAREDPTR FIXME - // void (RouteRedirectSelection::*pmf)(Route*) = &RouteRedirectSelection::remove; - // r->GoingAway.connect (bind (mem_fun(*this, pmf), r)); +void +RouteRedirectSelection::removed (boost::weak_ptr wr) +{ + boost::shared_ptr r (wr.lock()); - RoutesChanged(); + if (!r) { + return; } + + remove (r); } void RouteRedirectSelection::remove (boost::shared_ptr r) { + ENSURE_GUI_THREAD (*this, &RouteRedirectSelection::remove, r); + list >::iterator i; if ((i = find (routes.begin(), routes.end(), r)) != routes.end()) { routes.erase (i);