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