X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Froute_processor_selection.cc;h=b3a6620f6bf1bca3f56fea40f7c90d7857ae642b;hb=8b3d50f7e6c4ab7575b169cccc54efc0e2a94fd0;hp=552de1b412028c75d3ad8eeb00f618c811f1a0f3;hpb=6698f5f686bef82b0c9568558c83a3b9b3344700;p=ardour.git diff --git a/gtk2_ardour/route_processor_selection.cc b/gtk2_ardour/route_processor_selection.cc index 552de1b412..b3a6620f6b 100644 --- a/gtk2_ardour/route_processor_selection.cc +++ b/gtk2_ardour/route_processor_selection.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002 Paul Davis + Copyright (C) 2002 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,19 +19,20 @@ #include #include -#include +#include "pbd/error.h" -#include -#include -#include +#include "ardour/playlist.h" +#include "ardour/processor.h" +#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) @@ -68,6 +69,7 @@ void RouteRedirectSelection::clear_routes () { routes.clear (); + drop_connections (); RoutesChanged (); } @@ -92,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); @@ -129,4 +141,4 @@ RouteRedirectSelection::empty () { return processors.empty () && routes.empty (); } - +