1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 21:54:55 -04:00

Web API: fixed segfault when mixing start/stop between GUI and API. Applied to BladeRF input, SDRdaemon input and SDRPlay

This commit is contained in:
f4exb
2017-12-14 00:19:59 +01:00
parent 8798b64471
commit 53925bd4fd
10 changed files with 199 additions and 66 deletions
+13 -11
View File
@@ -33,6 +33,7 @@ SDRPlayGui::SDRPlayGui(DeviceUISet *deviceUISet, QWidget* parent) :
QWidget(parent),
ui(new Ui::SDRPlayGui),
m_deviceUISet(deviceUISet),
m_doApplySettings(true),
m_forceSettings(true)
{
m_sampleSource = (SDRPlayInput*) m_deviceUISet->m_deviceSourceAPI->getSampleSource();
@@ -163,6 +164,15 @@ bool SDRPlayGui::handleMessage(const Message& message)
return true;
}
else if (SDRPlayInput::MsgStartStop::match(message))
{
SDRPlayInput::MsgStartStop& notif = (SDRPlayInput::MsgStartStop&) message;
blockApplySettings(true);
ui->startStop->setChecked(notif.getStartStop());
blockApplySettings(false);
return true;
}
else
{
return false;
@@ -433,18 +443,10 @@ void SDRPlayGui::on_gainBaseband_valueChanged(int value)
void SDRPlayGui::on_startStop_toggled(bool checked)
{
if (checked)
if (m_doApplySettings)
{
if (m_deviceUISet->m_deviceSourceAPI->initAcquisition())
{
m_deviceUISet->m_deviceSourceAPI->startAcquisition();
DSPEngine::instance()->startAudioOutput();
}
}
else
{
m_deviceUISet->m_deviceSourceAPI->stopAcquisition();
DSPEngine::instance()->stopAudioOutput();
SDRPlayInput::MsgStartStop *message = SDRPlayInput::MsgStartStop::create(checked);
m_sampleSource->getInputMessageQueue()->push(message);
}
}