diff --git a/mixer/src/Mixer_Strip.C b/mixer/src/Mixer_Strip.C index 55aeb25..ade7c33 100644 --- a/mixer/src/Mixer_Strip.C +++ b/mixer/src/Mixer_Strip.C @@ -1037,14 +1037,19 @@ Mixer_Strip::maybe_auto_connect_output ( Module::Port *p ) if ( ! _auto_input ) { /* break any previous connection between this port and this module */ - p->disconnect_from_strip(this); + p->disconnect_from_strip(this); } if ( _auto_input && matches_pattern( _auto_input, p ) ) { + /* FIXME: would be faster if we avoided breaking and remaking + * the same connections, while still breaking connections that + * will not be remade */ + /* break any prior auto-connection */ p->disconnect(); - + + // FIXME: Find a better way to get the port index. const char* jack_name = p->jack_port()->jack_name(); diff --git a/mixer/src/Module.C b/mixer/src/Module.C index 79cb2f3..115db7b 100644 --- a/mixer/src/Module.C +++ b/mixer/src/Module.C @@ -285,17 +285,16 @@ Module::paste_before ( void ) void Module::Port::disconnect_from_strip ( Mixer_Strip *o ) { - for ( std::list::iterator i = _connected.begin(); i != _connected.end(); i++ ) + for ( std::list::iterator i = _connected.begin(); i != _connected.end(); ) { Port *p = *i; + i++; /* iterator trick */ + if ( p->module()->chain()->strip() == o ) { - /* iterator about to be invalidated... */ - i = _connected.erase(i); - disconnect(p); - } + } } }