mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 00:04:56 +01:00
Do not modify read-only RCU copy of routelist
RCU reader returns a shared ptr to the current object which can also be used in other places at the same time. Sorting the shared-ptr list invalidates iterators which can throw off other users of the same object. This fixes a bug in PT-import which calls get_nth_audio_track().
This commit is contained in:
parent
979f9876a7
commit
f3e13848fa
1 changed files with 4 additions and 4 deletions
|
|
@ -6408,11 +6408,11 @@ Session::route_removed_from_route_group (RouteGroup* rg, std::weak_ptr<Route> r)
|
||||||
std::shared_ptr<AudioTrack>
|
std::shared_ptr<AudioTrack>
|
||||||
Session::get_nth_audio_track (uint32_t nth) const
|
Session::get_nth_audio_track (uint32_t nth) const
|
||||||
{
|
{
|
||||||
std::shared_ptr<RouteList> rl = routes.reader ();
|
RouteList rl (*(routes.reader ()));
|
||||||
rl->sort (Stripable::Sorter ());
|
rl.sort (Stripable::Sorter());
|
||||||
|
|
||||||
for (RouteList::const_iterator r = rl->begin(); r != rl->end(); ++r) {
|
for (auto const& r: rl) {
|
||||||
std::shared_ptr<AudioTrack> at = std::dynamic_pointer_cast<AudioTrack> (*r);
|
std::shared_ptr<AudioTrack> at = std::dynamic_pointer_cast<AudioTrack> (r);
|
||||||
if (!at) {
|
if (!at) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue