diff options
author | David Robillard <d@drobilla.net> | 2014-12-06 16:46:00 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-12-06 16:46:00 -0500 |
commit | 9f5023175f60d0c9470f799530e2c6077629f65e (patch) | |
tree | 54dd0d9d7a7a73fd9e6ac84e12e8b7bfb8d4f7b2 /gtk2_ardour/midi_streamview.cc | |
parent | 60f4f5b9d8a3df175f828b9c32c0cb75eb5f4d98 (diff) |
Fix crash when showing MIDI regions we shouldn't.
I am not sure what causes this, but it can happen when finishing a record
sometimes. Probably MidiSource::_writing isn't updated in the right order with
whatever triggers the redisplay, but at least not crashing is better...
Diffstat (limited to 'gtk2_ardour/midi_streamview.cc')
-rw-r--r-- | gtk2_ardour/midi_streamview.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index c862a23e04..27bd465fe1 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -176,19 +176,28 @@ MidiStreamView::display_region(MidiRegionView* region_view, bool load_model) } region_view->enable_display (true); + region_view->set_height (child_height()); boost::shared_ptr<MidiSource> source(region_view->midi_region()->midi_source(0)); + if (!source) { + error << _("attempt to display MIDI region with no source") << endmsg; + return; + } if (load_model) { source->load_model(); } + if (!source->model()) { + error << _("attempt to display MIDI region with no model") << endmsg; + return; + } + _range_dirty = update_data_note_range( source->model()->lowest_note(), source->model()->highest_note()); // Display region contents - region_view->set_height (child_height()); region_view->display_model(source->model()); } |