more MTC debugging
[ardour.git] / libs / ardour / route_group.cc
index 1da2eda67820fedd99bdd9a2f2e50945eab82944..e1d43f4cd6a72401d2ac8eccddc943cb3b34db2c 100644 (file)
@@ -68,15 +68,22 @@ RouteGroup::set_name (string str)
        FlagsChanged (0); /* EMIT SIGNAL */
 }
 
+/** Add a route to a group.  Adding a route which is already in the group is allowed; nothing will happen.
+ *  @param r Route to add.
+ */
 int
 RouteGroup::add (boost::shared_ptr<Route> r)
 {
+       if (find (routes->begin(), routes->end(), r) != routes->end()) {
+               return 0;
+       }
+       
        r->leave_route_group ();
 
        routes->push_back (r);
 
        r->join_route_group (this);
-       r->GoingAway.connect (*this, boost::bind (&RouteGroup::remove_when_going_away, this, boost::weak_ptr<Route> (r)));
+       r->DropReferences.connect_same_thread (*this, boost::bind (&RouteGroup::remove_when_going_away, this, boost::weak_ptr<Route> (r)));
        
        _session.set_dirty ();
        changed (); /* EMIT SIGNAL */