From ca0ef1702eedf263a30cbfbb186440b9fec7d305 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 9 Oct 2026 16:34:42 -0400 Subject: [PATCH] demodwfm: Prevent unsafe copying of WFMDemodSink Explicitly delete the copy constructor and copy assignment operator for WFMDemodSink, which manages resources that should not be shared through implicit shallow copies. The implicitly generated copy operations could leave multiple WFMDemodSink instances referring to the same resources, potentially causing invalid ownership or double deletion. Since WFMDemodSink 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 --- plugins/channelrx/demodwfm/wfmdemodsink.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/channelrx/demodwfm/wfmdemodsink.h b/plugins/channelrx/demodwfm/wfmdemodsink.h index 48098408f..38ae5db12 100644 --- a/plugins/channelrx/demodwfm/wfmdemodsink.h +++ b/plugins/channelrx/demodwfm/wfmdemodsink.h @@ -35,7 +35,9 @@ class ChannelAPI; class WFMDemodSink : public ChannelSampleSink { public: WFMDemodSink(); - ~WFMDemodSink(); + ~WFMDemodSink(); + WFMDemodSink(const WFMDemodSink&) = delete; + WFMDemodSink& operator=(const WFMDemodSink&) = delete; virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);