From 2a262b55cbaa1e27f1e55b80ad2893fd408e0e2a Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 23 May 2012 20:32:12 +0000 Subject: [PATCH] stop deadlock when pasting into a playlist git-svn-id: svn://localhost/ardour2/branches/3.0@12400 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/playlist.cc | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 0e1aad110d..12490d02d7 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -1196,7 +1196,6 @@ Playlist::flush_notifications (bool from_undo) times = fabs (times); { - RegionWriteLock rl1 (this); RegionReadLock rl2 (other.get()); int itimes = (int) floor (times); @@ -1204,18 +1203,21 @@ Playlist::flush_notifications (bool from_undo) framecnt_t const shift = other->_get_extent().second; layer_t top = top_layer (); - while (itimes--) { - for (RegionList::iterator i = other->regions.begin(); i != other->regions.end(); ++i) { - boost::shared_ptr copy_of_region = RegionFactory::create (*i, true); - - /* put these new regions on top of all existing ones, but preserve - the ordering they had in the original playlist. - */ - - add_region_internal (copy_of_region, (*i)->position() + pos); - set_layer (copy_of_region, copy_of_region->layer() + top); + { + RegionWriteLock rl1 (this); + while (itimes--) { + for (RegionList::iterator i = other->regions.begin(); i != other->regions.end(); ++i) { + boost::shared_ptr copy_of_region = RegionFactory::create (*i, true); + + /* put these new regions on top of all existing ones, but preserve + the ordering they had in the original playlist. + */ + + add_region_internal (copy_of_region, (*i)->position() + pos); + set_layer (copy_of_region, copy_of_region->layer() + top); + } + pos += shift; } - pos += shift; } }