From a2c35b0b97fd5eb3f7111e44b96bb699ed31b941 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 9 Oct 2026 16:40:43 -0400 Subject: [PATCH] device: Prevent unsafe copying of DeviceSet Explicitly delete the copy constructor and copy assignment operator for DeviceSet, which manages device and channel state that should not be duplicated through implicit shallow copies. The implicitly generated copy operations could duplicate internal state and resource references, potentially causing inconsistent device state or invalid resource ownership. Since DeviceSet is not intended to be copied or assigned, prohibit both operations at compile time to prevent unsafe duplication. cppcheck identified the missing copy constructor and assignment operator with its noCopyConstructor and noOperatorEq warnings. Signed-off-by: Robin Getz --- sdrbase/device/deviceset.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdrbase/device/deviceset.h b/sdrbase/device/deviceset.h index 09596a252..074d09f71 100644 --- a/sdrbase/device/deviceset.h +++ b/sdrbase/device/deviceset.h @@ -56,6 +56,8 @@ public: DeviceSet(int tabIndex, int deviceType); ~DeviceSet(); + DeviceSet(const DeviceSet&) = delete; + DeviceSet& operator=(const DeviceSet&) = delete; int getNumberOfChannels() const { return m_channelInstanceRegistrations.size(); } int getIndex() const { return m_deviceTabIndex; }