fix VST plugin crash (from 35a9c63)
[ardour.git] / gtk2_ardour / midi_time_axis.cc
index bbf0473ded61b5494d22404b00bf7744d5830744..e412b82c32d10f5ef569b0d0c78b9e7ebba4eb32 100644 (file)
@@ -243,18 +243,22 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
                _view->RegionViewAdded.connect (
                        sigc::mem_fun(*this, &MidiTimeAxisView::region_view_added));
 
-               midi_track()->PlaybackChannelModeChanged.connect (*this, invalidator (*this),
-                                                                 boost::bind (&MidiTimeAxisView::playback_channel_mode_changed, this),
-                                                                 gui_context());
-               midi_track()->PlaybackChannelMaskChanged.connect (*this, invalidator (*this),
-                                                                 boost::bind (&MidiTimeAxisView::playback_channel_mode_changed, this),
-                                                                 gui_context());
-               midi_track()->CaptureChannelModeChanged.connect (*this, invalidator (*this),
-                                                                 boost::bind (&MidiTimeAxisView::capture_channel_mode_changed, this),
-                                                                 gui_context());
-               midi_track()->CaptureChannelMaskChanged.connect (*this, invalidator (*this),
-                                                                 boost::bind (&MidiTimeAxisView::capture_channel_mode_changed, this),
-                                                                 gui_context());
+               midi_track()->playback_filter().ChannelModeChanged.connect (
+                       *this, invalidator (*this),
+                       boost::bind (&MidiTimeAxisView::playback_channel_mode_changed, this),
+                       gui_context());
+               midi_track()->playback_filter().ChannelMaskChanged.connect (
+                       *this, invalidator (*this),
+                       boost::bind (&MidiTimeAxisView::playback_channel_mode_changed, this),
+                       gui_context());
+               midi_track()->capture_filter().ChannelModeChanged.connect (
+                       *this, invalidator (*this),
+                       boost::bind (&MidiTimeAxisView::capture_channel_mode_changed, this),
+                       gui_context());
+               midi_track()->capture_filter().ChannelMaskChanged.connect (
+                       *this, invalidator (*this),
+                       boost::bind (&MidiTimeAxisView::capture_channel_mode_changed, this),
+                       gui_context());
 
                playback_channel_mode_changed ();
                capture_channel_mode_changed ();
@@ -1505,8 +1509,9 @@ boost::shared_ptr<MidiRegion>
 MidiTimeAxisView::add_region (framepos_t pos, framecnt_t length, bool commit)
 {
        Editor* real_editor = dynamic_cast<Editor*> (&_editor);
-
-       real_editor->begin_reversible_command (Operations::create_region);
+       if (commit) {
+               real_editor->begin_reversible_command (Operations::create_region);
+       }
        playlist()->clear_changes ();
 
        real_editor->snap_to (pos, RoundNearest);