1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-19 09:01:15 +02:00

All tracks allocated with make_shared, no more make_unique...

... so that we can use Track::SharedPointer without undefined behavior even on
tracks that don't yet belong to any TrackList.

Also fix the return type of function template TrackList::Add and remove some
casts.
This commit is contained in:
Paul Licameli
2018-11-18 23:07:05 -05:00
parent 6f89c48873
commit a0aa69a248
18 changed files with 60 additions and 109 deletions

View File

@@ -41,10 +41,8 @@ int DoAddLabel(
auto lt = * iter.Filter< LabelTrack >();
// If none found, start a NEW label track and use it
if (!lt) {
lt = static_cast<LabelTrack*>
(tracks->Add(trackFactory->NewLabelTrack()));
}
if (!lt)
lt = tracks->Add(trackFactory->NewLabelTrack());
// LLL: Commented as it seemed a little forceful to remove users
// selection when adding the label. This does not happen if
@@ -158,7 +156,7 @@ void EditByLabel(
}
}
using EditDestFunction = std::unique_ptr<Track> (WaveTrack::*)(double, double);
using EditDestFunction = std::shared_ptr<Track> (WaveTrack::*)(double, double);
//Executes the edit function on all selected wave tracks with
//regions specified by selected labels