Fix rule of three for SampleBuffer, SampleTCO (#5727)
* Automatic formatting changes * Add copy constructor and assignemnt to SampleBuffer * Add copy constructor to SampleTCO * Delete SampleTCO copy assignment, initial work on SampleBuffer swap method * SampleBuffer: Finish(?) swap and use it for copy assignment, lock for read in copy constructor * Don't forget to unlock in copy assignment! * Formatting changes * Lock ordering in swap * Fix leak and constness Co-authored-by: Dominic Clark <mrdomclark@gmail.com> * Fix multiplication style, ensure lock is held when necessary ... by switching from an initializer list to manual assignments. * Fixes from review * Avoid more undefined behavior * Update src/tracks/SampleTrack.cpp Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
This commit is contained in:
@@ -109,6 +109,10 @@ public:
|
||||
SampleBuffer(const QString & audioFile, bool isBase64Data = false);
|
||||
SampleBuffer(const sampleFrame * data, const f_cnt_t frames);
|
||||
explicit SampleBuffer(const f_cnt_t frames);
|
||||
SampleBuffer(const SampleBuffer & orig);
|
||||
|
||||
friend void swap(SampleBuffer & first, SampleBuffer & second) noexcept;
|
||||
SampleBuffer& operator= (const SampleBuffer that);
|
||||
|
||||
virtual ~SampleBuffer();
|
||||
|
||||
@@ -311,7 +315,7 @@ private:
|
||||
sampleFrame * m_origData;
|
||||
f_cnt_t m_origFrames;
|
||||
sampleFrame * m_data;
|
||||
QReadWriteLock m_varLock;
|
||||
mutable QReadWriteLock m_varLock;
|
||||
f_cnt_t m_frames;
|
||||
f_cnt_t m_startFrame;
|
||||
f_cnt_t m_endFrame;
|
||||
|
||||
@@ -50,8 +50,11 @@ class SampleTCO : public TrackContentObject
|
||||
mapPropertyFromModel(bool,isRecord,setRecord,m_recordModel);
|
||||
public:
|
||||
SampleTCO( Track * _track );
|
||||
SampleTCO( const SampleTCO& orig );
|
||||
virtual ~SampleTCO();
|
||||
|
||||
SampleTCO& operator=( const SampleTCO& that ) = delete;
|
||||
|
||||
void changeLength( const TimePos & _length ) override;
|
||||
const QString & sampleFile() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user