fix iq_exporter module crashing when removed in the case it's disabled and in baseband mode

pull/1338/head
AlexandreRouma 2024-02-12 22:43:16 +01:00
rodzic 01ab1831e8
commit 61c14bab48
1 zmienionych plików z 7 dodań i 6 usunięć

Wyświetl plik

@ -408,9 +408,9 @@ private:
if (!_this->enabled) { ImGui::EndDisabled(); } 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 there is no mode to change, do nothing
if (!fromDisabled && mode == newMode) { return; } if (!forceSet && mode == newMode) { return; }
// Stop the DSP // Stop the DSP
reshape.stop(); reshape.stop();
@ -421,14 +421,13 @@ private:
sigpath::vfoManager.deleteVFO(vfo); sigpath::vfoManager.deleteVFO(vfo);
vfo = NULL; vfo = NULL;
} }
if (mode == MODE_BASEBAND && !fromDisabled) { if (streamBound) {
sigpath::iqFrontEnd.unbindIQStream(&iqStream); sigpath::iqFrontEnd.unbindIQStream(&iqStream);
streamBound = false;
} }
// If the mode was none, we're done // If the mode was none, we're done
if (newMode == MODE_NONE) { if (newMode == MODE_NONE) { return; }
return;
}
// Create VFO or bind IQ stream // Create VFO or bind IQ stream
if (newMode == MODE_VFO) { if (newMode == MODE_VFO) {
@ -441,6 +440,7 @@ private:
else { else {
// Bind IQ stream // Bind IQ stream
sigpath::iqFrontEnd.bindIQStream(&iqStream); sigpath::iqFrontEnd.bindIQStream(&iqStream);
streamBound = true;
// Set its output as the input to the DSP // Set its output as the input to the DSP
reshape.setInput(&iqStream); reshape.setInput(&iqStream);
@ -555,6 +555,7 @@ private:
OptionList<int, int> packetSizes; OptionList<int, int> packetSizes;
VFOManager::VFO* vfo = NULL; VFOManager::VFO* vfo = NULL;
bool streamBound = false;
dsp::stream<dsp::complex_t> iqStream; dsp::stream<dsp::complex_t> iqStream;
dsp::buffer::Reshaper<dsp::complex_t> reshape; dsp::buffer::Reshaper<dsp::complex_t> reshape;
dsp::sink::Handler<dsp::complex_t> handler; dsp::sink::Handler<dsp::complex_t> handler;