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
@ -6408,11 +6408,11 @@ Session::route_removed_from_route_group (RouteGroup* rg, std::weak_ptr<Route> r)
|
||||
std::shared_ptr<AudioTrack>
|
||||
Session::get_nth_audio_track (uint32_t nth) const
|
||||
{
|
||||
std::shared_ptr<RouteList> rl = routes.reader ();
|
||||
rl->sort (Stripable::Sorter ());
|
||||
RouteList rl (*(routes.reader ()));
|
||||
rl.sort (Stripable::Sorter());
|
||||
|
||||
for (RouteList::const_iterator r = rl->begin(); r != rl->end(); ++r) {
|
||||
std::shared_ptr<AudioTrack> at = std::dynamic_pointer_cast<AudioTrack> (*r);
|
||||
for (auto const& r: rl) {
|
||||
std::shared_ptr<AudioTrack> at = std::dynamic_pointer_cast<AudioTrack> (r);
|
||||
if (!at) {
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user