1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-21 16:37:12 +01: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

@@ -58,28 +58,24 @@ using Regions = std::vector < Region >;
class Envelope;
class AUDACITY_DLL_API WaveTrack final : public PlayableTrack {
private:
public:
//
// Constructor / Destructor / Duplicator
//
// Private since only factories are allowed to construct WaveTracks
//
WaveTrack(const std::shared_ptr<DirManager> &projDirManager,
sampleFormat format = (sampleFormat)0,
double rate = 0);
WaveTrack(const WaveTrack &orig);
void Init(const WaveTrack &orig);
public:
// overwrite data excluding the sample sequence but including display
// settings
void Reinit(const WaveTrack &orig);
private:
void Init(const WaveTrack &orig);
Track::Holder Duplicate() const override;
friend class TrackFactory;
@@ -87,7 +83,7 @@ private:
public:
typedef WaveTrackLocation Location;
using Holder = std::unique_ptr<WaveTrack>;
using Holder = std::shared_ptr<WaveTrack>;
virtual ~WaveTrack();