From 282c563fce744b97c22d36a3e78a861e220f8e6b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 20 Dec 2014 14:09:33 -0500 Subject: [PATCH] fix newly introduced deadlock when cloning MIDI regions --- libs/ardour/midi_region.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index e94e4e4854..c399b4e438 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -151,7 +151,16 @@ MidiRegion::clone (boost::shared_ptr newsrc) const Evoral::MusicalTime const bend = bfc.from (_start + _length); { - Source::Lock lm(newsrc->mutex()); + Source::Lock lm (midi_source(0)->mutex()); + /* ::write_to() will take the lock on newsrc. + + XXX taking the lock on our own source here seems + partly sane and partly odd. We don't write the + data to the newsrc from our source, but from + the in memory copy. This whole thing (memory vs. disk, SMF + versus MidiModel) is so f'ed up that its no wonder + stuff is wierd sometimes. + */ if (midi_source(0)->write_to (lm, newsrc, bbegin, bend)) { return boost::shared_ptr (); }