From 8f87a67ed6b644ddcc24cb7ef3cee690caba280e Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 9 Oct 2026 16:20:50 -0400 Subject: [PATCH] ft8: Prevent unsafe copy construction and assignment of FFTEngine Explicitly delete the copy constructor and copy assignment operator for FFTEngine, which owns dynamically allocated FFTBuffers. Allowing the implicitly generated copy operations would result in shallow copies of m_fftBuffers, leaving multiple FFTEngine instances referring to the same resource and potentially causing invalid ownership or double deletion. Since FFTEngine is not intended to be copied or assigned, prohibit both operations at compile time, turning potential runtime errors into compile-time errors. cppcheck identified the missing copy constructor and assignment operator with its noCopyConstructor and noOperatorEq warnings. Signed-off-by: Robin Getz --- ft8/fft.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ft8/fft.h b/ft8/fft.h index 26c17f24b..af0c9f090 100644 --- a/ft8/fft.h +++ b/ft8/fft.h @@ -49,6 +49,8 @@ public: FFTEngine(); ~FFTEngine(); + FFTEngine(const FFTEngine&) = delete; + FFTEngine& operator=(const FFTEngine&) = delete; private: std::vector> analytic(const std::vector &x);