Browse Source

modatv: Prevent unsafe copying of ATVModSource

Explicitly delete the copy constructor and copy assignment operator for
ATVModSource, which manages resources that should not be shared through
implicit shallow copies.

The implicitly generated copy operations could leave multiple ATVModSource
instances referring to the same resources, potentially causing invalid
ownership or double deletion.

Since ATVModSource is not intended to be copied or assigned, prohibit both
operations at compile time, turning potential runtime errors into
compile-time errors.

cppcheck identified the missing copy constructor and assignment operator
with its noCopyConstructor and noOperatorEq warnings.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
chirpmodem-v8.0.0
Robin Getz 1 month ago
parent
commit
04af740964
No known key found for this signature in database
GPG Key ID: 51C7231FFED0E060
  1. 3
      plugins/channeltx/modatv/atvmodsource.h

3
plugins/channeltx/modatv/atvmodsource.h

@ -46,6 +46,9 @@ class ATVModSource : public ChannelSampleSource @@ -46,6 +46,9 @@ class ATVModSource : public ChannelSampleSource
public:
ATVModSource();
~ATVModSource();
ATVModSource(const ATVModSource&) = delete;
ATVModSource& operator=(const ATVModSource&) = delete;
virtual void pull(SampleVector::iterator begin, unsigned int nbSamples);
virtual void pullOne(Sample& sample);

Loading…
Cancel
Save