Mixer: Don't die when spatialization plugin is removed.

This commit is contained in:
Jonathan Moore Liles 2013-04-14 18:45:48 -07:00
parent b4d811adf1
commit f5eaf5bc2d
2 changed files with 17 additions and 7 deletions

View File

@ -351,12 +351,11 @@ Mixer_Strip::handle_module_added ( Module *m )
void void
Mixer_Strip::handle_module_removed ( Module *m ) Mixer_Strip::handle_module_removed ( Module *m )
{ {
if ( spatialization_controller->control_output[0].connected() && if ( spatialization_controller->control_output[0].connected() &&
spatialization_controller->control_output[0].connected_port()->module() == m ) spatialization_controller->control_output[0].connected_port()->module() == m )
{ {
spatialization_controller->hide(); set_spatializer_visibility();
DMESSAGE( "Module \"%s\" disconnected from spatialization controller", m->name() ); DMESSAGE( "Module \"%s\" disconnected from spatialization controller", m->label() );
} }
} }

View File

@ -58,9 +58,9 @@ Module::Module ( int W, int H, const char *L ) : Fl_Group( 0, 0, W, H, L )
Module::Module ( bool is_default, int W, int H, const char *L ) : Fl_Group( 0, 0, W, H, L ), Loggable( !is_default ) Module::Module ( bool is_default, int W, int H, const char *L ) : Fl_Group( 0, 0, W, H, L ), Loggable( !is_default )
{ {
this->is_default( is_default );
init(); init();
this->is_default( is_default );
} }
Module::Module ( ) : Fl_Group( 0, 0, 50, 50, "Unnamed" ) Module::Module ( ) : Fl_Group( 0, 0, 50, 50, "Unnamed" )
@ -88,9 +88,20 @@ Module::~Module ( )
if ( control_input[i].connected() ) if ( control_input[i].connected() )
{ {
Module *o = (Module*)control_input[i].connected_port()->module(); Module *o = (Module*)control_input[i].connected_port()->module();
if ( ! o->is_default() )
{
control_input[i].disconnect();
DMESSAGE( "Deleting connected module %s", o->label() );
delete o;
}
else
{
control_input[i].disconnect();
}
control_input[i].disconnect();
delete o;
} }
control_input[i].destroy_osc_port(); control_input[i].destroy_osc_port();