diff options
author | David Robillard <d@drobilla.net> | 2013-01-19 07:00:43 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-01-19 07:00:43 +0000 |
commit | fc77ae0738565770abde1a25f650a035cf082af0 (patch) | |
tree | f4edb7bcdcddf186fcf5cf4fb033e602580e4008 /libs/ardour/midi_stretch.cc | |
parent | d251c68d7676a18ab9ed935e22558e2b18981b41 (diff) |
Replace a bunch of potential crashes with graceful handling of the situation.
We really need some kind of more sophisticated assert macro that can be
switched to non-fatal logging mode for release builds. A log message, which is
often all that would happen, is a lot better than a trainwrecked performance...
git-svn-id: svn://localhost/ardour2/branches/3.0@13892 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_stretch.cc')
-rw-r--r-- | libs/ardour/midi_stretch.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libs/ardour/midi_stretch.cc b/libs/ardour/midi_stretch.cc index 1794d5ff93..38cab08ace 100644 --- a/libs/ardour/midi_stretch.cc +++ b/libs/ardour/midi_stretch.cc @@ -49,8 +49,9 @@ MidiStretch::run (boost::shared_ptr<Region> r, Progress*) char suffix[32]; boost::shared_ptr<MidiRegion> region = boost::dynamic_pointer_cast<MidiRegion>(r); - if (!region) + if (!region) { return -1; + } /* the name doesn't need to be super-precise, but allow for 2 fractional digits just to disambiguate close but not identical stretches. @@ -74,16 +75,16 @@ MidiStretch::run (boost::shared_ptr<Region> r, Progress*) if (make_new_sources (region, nsrcs, suffix)) return -1; - // FIXME: how to make a whole file region if it isn't? - //assert(region->whole_file()); - boost::shared_ptr<MidiSource> src = region->midi_source(0); src->load_model(); boost::shared_ptr<MidiModel> old_model = src->model(); boost::shared_ptr<MidiSource> new_src = boost::dynamic_pointer_cast<MidiSource>(nsrcs[0]); - assert(new_src); + if (!new_src) { + error << _("MIDI stretch created non-MIDI source") << endmsg; + return -1; + } Glib::Threads::Mutex::Lock sl (new_src->mutex ()); |