From 0706416d6208b96c74ec3a230f49faf902bb199b Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 9 Oct 2026 16:48:17 -0400 Subject: [PATCH] gui: Prevent unsafe copying of TVScreenAnalogBuffer Explicitly delete the copy constructor and copy assignment operator for TVScreenAnalogBuffer to prevent accidental duplication of its buffer. The destructor deletes m_outOfBoundsLine with delete[]. A shallow copy would cause multiple instances to own the same array, potentially resulting in double deletion and memory corruption. Since TVScreenAnalogBuffer manages this buffer directly, prohibit copying and assignment at compile time. cppcheck identified the missing copy constructor and assignment operator with its noCopyConstructor and noOperatorEq warnings. Signed-off-by: Robin Getz --- sdrgui/gui/tvscreenanalog.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdrgui/gui/tvscreenanalog.h b/sdrgui/gui/tvscreenanalog.h index a9ced2117..357bd824d 100644 --- a/sdrgui/gui/tvscreenanalog.h +++ b/sdrgui/gui/tvscreenanalog.h @@ -62,6 +62,9 @@ public: delete[] m_outOfBoundsLine; } + TVScreenAnalogBuffer(const TVScreenAnalogBuffer&) = delete; + TVScreenAnalogBuffer& operator=(const TVScreenAnalogBuffer&) = delete; + int getWidth() { return m_width;