13
0

Cont'd work to prevent region creation signal-emission

This fixes another deadlock calling send_change with the
Playlist's RegionWriteLock held.

In this case due to "MIDI region copies are independent"
when duplicating MIDI regions.

```
ARDOUR::Region::send_change ()
PBD::Stateful::apply_changes ()
ARDOUR::RegionFactory::create ()
ARDOUR::RegionFactory::create ()
ARDOUR::MidiRegion::clone ()
ARDOUR::RegionFactory::create ()
ARDOUR::Playlist::duplicate ()
```
This commit is contained in:
Robin Gareus 2021-05-01 16:13:51 +02:00
parent 747a3d4a7b
commit c8585fce90
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 8 additions and 6 deletions

View File

@ -57,6 +57,7 @@ class MidiStateTracker;
class Playlist;
class Route;
class Session;
class ThawList;
template<typename T> class MidiRingBuffer;
@ -70,7 +71,7 @@ class LIBARDOUR_API MidiRegion : public Region
bool do_export (std::string path) const;
boost::shared_ptr<MidiRegion> clone (std::string path = std::string()) const;
boost::shared_ptr<MidiRegion> clone (boost::shared_ptr<MidiSource>) const;
boost::shared_ptr<MidiRegion> clone (boost::shared_ptr<MidiSource>, ThawList* tl = 0) const;
boost::shared_ptr<MidiSource> midi_source (uint32_t n=0) const;

View File

@ -247,7 +247,7 @@ MidiPlaylist::_split_region (boost::shared_ptr<Region> region, const MusicSample
since it supplies that offset to the Region constructor, which
is necessary to get audio region gain envelopes right.
*/
left = RegionFactory::create (region, MusicSample (0, 0), plist, true);
left = RegionFactory::create (region, MusicSample (0, 0), plist, true, &thawlist);
}
RegionFactory::region_name (after_name, region->name(), false);
@ -263,7 +263,7 @@ MidiPlaylist::_split_region (boost::shared_ptr<Region> region, const MusicSample
plist.add (Properties::layer, region->layer ());
/* same note as above */
right = RegionFactory::create (region, before, plist, true);
right = RegionFactory::create (region, before, plist, true, &thawlist);
}
add_region_internal (left, region->position(), thawlist, 0, region->quarter_note(), true);

View File

@ -49,6 +49,7 @@
#include "ardour/session.h"
#include "ardour/source_factory.h"
#include "ardour/tempo.h"
#include "ardour/thawlist.h"
#include "ardour/types.h"
#include "ardour/evoral_types_convert.h"
@ -180,7 +181,7 @@ MidiRegion::clone (string path) const
}
boost::shared_ptr<MidiRegion>
MidiRegion::clone (boost::shared_ptr<MidiSource> newsrc) const
MidiRegion::clone (boost::shared_ptr<MidiSource> newsrc, ThawList* tl) const
{
BeatsSamplesConverter bfc (_session.tempo_map(), _position);
Temporal::Beats const bbegin = bfc.from (_start);
@ -215,7 +216,7 @@ MidiRegion::clone (boost::shared_ptr<MidiSource> newsrc) const
plist.add (Properties::length_beats, _length_beats);
plist.add (Properties::layer, 0);
boost::shared_ptr<MidiRegion> ret (boost::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (newsrc, plist, true)));
boost::shared_ptr<MidiRegion> ret (boost::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (newsrc, plist, true, tl)));
ret->set_quarter_note (quarter_note());
return ret;

View File

@ -73,7 +73,7 @@ RegionFactory::create (boost::shared_ptr<const Region> region, bool announce, bo
boost::shared_ptr<MidiSource> source = mr->session ().create_midi_source_for_session (base);
source->set_ancestor_name (mr->sources ().front ()->name ());
ret = mr->clone (source);
ret = mr->clone (source, tl);
} else {
ret = boost::shared_ptr<Region> (new MidiRegion (mr, MusicSample (0, 0)));
}