From 6059728a16151f958af38f9dd8588a6fc6b4c131 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 9 Oct 2026 16:49:08 -0400 Subject: [PATCH] wdsp/unit: Prevent unsafe copying of Unit Explicitly delete the copy constructor and copy assignment operator for Unit to prevent accidental duplication of DSP processing state. Copying a Unit instance could duplicate internal buffer and processing state, potentially causing incorrect DSP behavior or resource-management problems. Since Unit is not intended to be copied or assigned, prohibit both operations at compile time. cppcheck identified the missing copy constructor and assignment operator with its noCopyConstructor and noOperatorEq warnings. Signed-off-by: Robin Getz --- wdsp/unit.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wdsp/unit.hpp b/wdsp/unit.hpp index a60844ddc..144c6f938 100644 --- a/wdsp/unit.hpp +++ b/wdsp/unit.hpp @@ -50,6 +50,9 @@ public: int _dsp_size // number complex samples processed per buffer in mainstream dsp processing ); ~Unit(); + Unit(const Unit&) = delete; + Unit& operator=(const Unit&) = delete; + void flushBuffers(); void setBuffersInputSamplerate(int _in_rate);