From 74daccaa817654bd45d8e8e32d26684cfee46be1 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 9 Oct 2026 16:39:36 -0400 Subject: [PATCH] audio: Prevent unsafe copying of AudioNetSink Explicitly delete the copy constructor and copy assignment operator for AudioNetSink, which manages audio output and network resources that should not be duplicated through implicit shallow copies. The implicitly generated copy operations could leave multiple AudioNetSink instances referring to the same resources, potentially causing invalid ownership or double deletion. Since AudioNetSink is not intended to be copied or assigned, prohibit both operations at compile time to prevent unsafe resource ownership. cppcheck identified the missing copy constructor and assignment operator with its noCopyConstructor and noOperatorEq warnings. Signed-off-by: Robin Getz --- sdrbase/audio/audionetsink.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdrbase/audio/audionetsink.h b/sdrbase/audio/audionetsink.h index 3e5be2b67..454b4099c 100644 --- a/sdrbase/audio/audionetsink.h +++ b/sdrbase/audio/audionetsink.h @@ -55,6 +55,8 @@ public: AudioNetSink(QObject *parent); //!< without RTP AudioNetSink(QObject *parent, int sampleRate, bool stereo); //!< with RTP ~AudioNetSink(); + AudioNetSink(const AudioNetSink&) = delete; + AudioNetSink& operator=(const AudioNetSink&) = delete; void setDestination(const QString& address, uint16_t port); void addDestination(const QString& address, uint16_t port);