summaryrefslogtreecommitdiff
path: root/gtk2_ardour/midi_time_axis.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-10-30 17:35:21 +0100
committerRobin Gareus <robin@gareus.org>2016-10-30 17:39:55 +0100
commit9773cfa92645f8caf8aa524a5e7f45bb4d4d1b24 (patch)
tree133e6016d1e29e91ab0a80a9dc1a1952397188e0 /gtk2_ardour/midi_time_axis.cc
parent997b48baf72c87281ae4dc535c9b3994810d8e72 (diff)
Drop UpdateMidnam shared_ptr reference when the plugin is removed
Diffstat (limited to 'gtk2_ardour/midi_time_axis.cc')
-rw-r--r--gtk2_ardour/midi_time_axis.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index fb2cebcd7e..4e4b541977 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -427,6 +427,12 @@ MidiTimeAxisView::setup_midnam_patches ()
}
void
+MidiTimeAxisView::drop_instrument_ref ()
+{
+ midnam_connection.drop_connections ();
+}
+
+void
MidiTimeAxisView::update_patch_selector ()
{
typedef MIDI::Name::MidiPatchManager PatchManager;
@@ -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());