Browse Source

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 <rgetz503@gmail.com>
chirpmodem-v8.0.0
Robin Getz 1 month ago
parent
commit
0706416d62
No known key found for this signature in database
GPG Key ID: 51C7231FFED0E060
  1. 3
      sdrgui/gui/tvscreenanalog.h

3
sdrgui/gui/tvscreenanalog.h

@ -62,6 +62,9 @@ public: @@ -62,6 +62,9 @@ public:
delete[] m_outOfBoundsLine;
}
TVScreenAnalogBuffer(const TVScreenAnalogBuffer&) = delete;
TVScreenAnalogBuffer& operator=(const TVScreenAnalogBuffer&) = delete;
int getWidth()
{
return m_width;

Loading…
Cancel
Save