diff --git a/sdrbase/dsp/fftfactory.cpp b/sdrbase/dsp/fftfactory.cpp
index 5367d4eae..46cb7efc6 100644
--- a/sdrbase/dsp/fftfactory.cpp
+++ b/sdrbase/dsp/fftfactory.cpp
@@ -15,10 +15,12 @@
// along with this program. If not, see . //
///////////////////////////////////////////////////////////////////////////////////
+#include
#include "fftfactory.h"
FFTFactory::FFTFactory(const QString& fftwWisdomFileName) :
- m_fftwWisdomFileName(fftwWisdomFileName)
+ m_fftwWisdomFileName(fftwWisdomFileName),
+ m_mutex(QMutex::Recursive)
{}
FFTFactory::~FFTFactory()
@@ -70,6 +72,7 @@ void FFTFactory::preallocate(
unsigned int FFTFactory::getEngine(unsigned int fftSize, bool inverse, FFTEngine **engine)
{
+ QMutexLocker mutexLocker(&m_mutex);
std::map>& enginesBySize = inverse ?
m_invFFTEngineBySize : m_fftEngineBySize;
@@ -121,6 +124,7 @@ unsigned int FFTFactory::getEngine(unsigned int fftSize, bool inverse, FFTEngine
void FFTFactory::releaseEngine(unsigned int fftSize, bool inverse, unsigned int engineSequence)
{
+ QMutexLocker mutexLocker(&m_mutex);
std::map>& enginesBySize = inverse ?
m_invFFTEngineBySize : m_fftEngineBySize;
diff --git a/sdrbase/dsp/fftfactory.h b/sdrbase/dsp/fftfactory.h
index 80aefed89..65859757e 100644
--- a/sdrbase/dsp/fftfactory.h
+++ b/sdrbase/dsp/fftfactory.h
@@ -21,6 +21,7 @@
#include