Browse Source

wdsprx: Prevent unsafe copying of WDSPRxSink

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

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

Since WDSPRxSink 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
b613d3d213
No known key found for this signature in database
GPG Key ID: 51C7231FFED0E060
  1. 4
      plugins/channelrx/wdsprx/wdsprxsink.h

4
plugins/channelrx/wdsprx/wdsprxsink.h

@ -42,7 +42,9 @@ namespace WDSP { @@ -42,7 +42,9 @@ namespace WDSP {
class WDSPRxSink : public ChannelSampleSink {
public:
WDSPRxSink();
~WDSPRxSink();
~WDSPRxSink();
WDSPRxSink(const WDSPRxSink&) = delete;
WDSPRxSink& operator=(const WDSPRxSink&) = delete;
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);

Loading…
Cancel
Save