From 61c14bab482ec377c3c9f9f25fa99c9643159664 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 12 Feb 2024 22:43:16 +0100 Subject: [PATCH] fix iq_exporter module crashing when removed in the case it's disabled and in baseband mode --- misc_modules/iq_exporter/src/main.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/misc_modules/iq_exporter/src/main.cpp b/misc_modules/iq_exporter/src/main.cpp index 4f8ec61d..645e3057 100644 --- a/misc_modules/iq_exporter/src/main.cpp +++ b/misc_modules/iq_exporter/src/main.cpp @@ -408,9 +408,9 @@ private: if (!_this->enabled) { ImGui::EndDisabled(); } } - void setMode(Mode newMode, bool fromDisabled = false) { + void setMode(Mode newMode, bool forceSet = false) { // If there is no mode to change, do nothing - if (!fromDisabled && mode == newMode) { return; } + if (!forceSet && mode == newMode) { return; } // Stop the DSP reshape.stop(); @@ -421,14 +421,13 @@ private: sigpath::vfoManager.deleteVFO(vfo); vfo = NULL; } - if (mode == MODE_BASEBAND && !fromDisabled) { + if (streamBound) { sigpath::iqFrontEnd.unbindIQStream(&iqStream); + streamBound = false; } // If the mode was none, we're done - if (newMode == MODE_NONE) { - return; - } + if (newMode == MODE_NONE) { return; } // Create VFO or bind IQ stream if (newMode == MODE_VFO) { @@ -441,6 +440,7 @@ private: else { // Bind IQ stream sigpath::iqFrontEnd.bindIQStream(&iqStream); + streamBound = true; // Set its output as the input to the DSP reshape.setInput(&iqStream); @@ -555,6 +555,7 @@ private: OptionList packetSizes; VFOManager::VFO* vfo = NULL; + bool streamBound = false; dsp::stream iqStream; dsp::buffer::Reshaper reshape; dsp::sink::Handler handler;