From e6377d4f3dc038e8a113e0ae83b49c4da51e244f Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Wed, 3 Nov 2021 16:30:32 +0100 Subject: [PATCH] Fixed waterfall recursive lock bug --- core/src/gui/widgets/waterfall.cpp | 20 ++++++++++---------- core/src/gui/widgets/waterfall.h | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/src/gui/widgets/waterfall.cpp b/core/src/gui/widgets/waterfall.cpp index 07965c1b..07013487 100644 --- a/core/src/gui/widgets/waterfall.cpp +++ b/core/src/gui/widgets/waterfall.cpp @@ -579,7 +579,7 @@ namespace ImGui { } void WaterFall::setFastFFT(bool fastFFT) { - std::lock_guard lck(buf_mtx); + std::lock_guard lck(buf_mtx); _fastFFT = fastFFT; } @@ -892,7 +892,7 @@ namespace ImGui { } void WaterFall::updatePallette(float colors[][3], int colorCount) { - std::lock_guard lck(buf_mtx); + std::lock_guard lck(buf_mtx); for (int i = 0; i < WATERFALL_RESOLUTION; i++) { int lowerId = floorf(((float)i / (float)WATERFALL_RESOLUTION) * colorCount); int upperId = ceilf(((float)i / (float)WATERFALL_RESOLUTION) * colorCount); @@ -908,7 +908,7 @@ namespace ImGui { } void WaterFall::updatePalletteFromArray(float* colors, int colorCount) { - std::lock_guard lck(buf_mtx); + std::lock_guard lck(buf_mtx); for (int i = 0; i < WATERFALL_RESOLUTION; i++) { int lowerId = floorf(((float)i / (float)WATERFALL_RESOLUTION) * colorCount); int upperId = ceilf(((float)i / (float)WATERFALL_RESOLUTION) * colorCount); @@ -969,7 +969,7 @@ namespace ImGui { } void WaterFall::setViewBandwidth(double bandWidth) { - std::lock_guard lck(buf_mtx); + std::lock_guard lck(buf_mtx); if (bandWidth == viewBandwidth) { return; } @@ -994,7 +994,7 @@ namespace ImGui { } void WaterFall::setViewOffset(double offset) { - std::lock_guard lck(buf_mtx); + std::lock_guard lck(buf_mtx); if (offset == viewOffset) { return; } @@ -1034,12 +1034,12 @@ namespace ImGui { } void WaterFall::setFullWaterfallUpdate(bool fullUpdate) { - std::lock_guard lck(buf_mtx); + std::lock_guard lck(buf_mtx); _fullUpdate = fullUpdate; } void WaterFall::setWaterfallMin(float min) { - std::lock_guard lck(buf_mtx); + std::lock_guard lck(buf_mtx); if (min == waterfallMin) { return; } @@ -1052,7 +1052,7 @@ namespace ImGui { } void WaterFall::setWaterfallMax(float max) { - std::lock_guard lck(buf_mtx); + std::lock_guard lck(buf_mtx); if (max == waterfallMax) { return; } @@ -1080,8 +1080,8 @@ namespace ImGui { } } - void WaterFall::setRawFFTSize(int size, bool lock) { - std::lock_guard lck(buf_mtx); + void WaterFall::setRawFFTSize(int size) { + std::lock_guard lck(buf_mtx); rawFFTSize = size; int wfSize = std::max(1, waterfallHeight); if (rawFFTs != NULL) { diff --git a/core/src/gui/widgets/waterfall.h b/core/src/gui/widgets/waterfall.h index 42ccf58e..3f505c1e 100644 --- a/core/src/gui/widgets/waterfall.h +++ b/core/src/gui/widgets/waterfall.h @@ -124,7 +124,7 @@ namespace ImGui { void setFFTHeight(int height); int getFFTHeight(); - void setRawFFTSize(int size, bool lock = true); + void setRawFFTSize(int size); void setFastFFT(bool fastFFT); @@ -227,7 +227,7 @@ namespace ImGui { GLuint textureId; - std::mutex buf_mtx; + std::recursive_mutex buf_mtx; float vRange;