13
0

Drop UpdateMidnam shared_ptr reference when the plugin is removed

This commit is contained in:
Robin Gareus 2016-10-30 17:35:21 +01:00
parent 997b48baf7
commit 9773cfa926
2 changed files with 12 additions and 2 deletions

View File

@ -426,6 +426,12 @@ MidiTimeAxisView::setup_midnam_patches ()
}
}
void
MidiTimeAxisView::drop_instrument_ref ()
{
midnam_connection.drop_connections ();
}
void
MidiTimeAxisView::update_patch_selector ()
{
@ -437,7 +443,10 @@ MidiTimeAxisView::update_patch_selector ()
boost::shared_ptr<Processor> the_instrument (_route->the_instrument());
boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert>(the_instrument);
if (pi && pi->plugin ()->has_midnam ()) {
midnam_connection.disconnect ();
midnam_connection.drop_connections ();
the_instrument->DropReferences.connect (midnam_connection, invalidator (*this),
boost::bind (&MidiTimeAxisView::drop_instrument_ref, this),
gui_context());
pi->plugin()->UpdateMidnam.connect (midnam_connection, invalidator (*this),
boost::bind (&Plugin::read_midnam, pi->plugin ()),
gui_context());

View File

@ -120,7 +120,8 @@ private:
void setup_midnam_patches ();
void update_patch_selector ();
PBD::ScopedConnection midnam_connection;
void drop_instrument_ref ();
PBD::ScopedConnectionList midnam_connection;
void model_changed(const std::string& model);
void custom_device_mode_changed(const std::string& mode);