1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-04 06:54:39 -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
@@ -124,9 +124,21 @@ bool BladerfInputGui::deserialize(const QByteArray& data)
}
}
bool BladerfInputGui::handleMessage(const Message& message __attribute__((unused)))
bool BladerfInputGui::handleMessage(const Message& message)
{
return false;
if (BladerfInput::MsgStartStop::match(message))
{
BladerfInput::MsgStartStop& notif = (BladerfInput::MsgStartStop&) message;
blockApplySettings(true);
ui->startStop->setChecked(notif.getStartStop());
blockApplySettings(false);
return true;
}
else
{
return false;
}
}
void BladerfInputGui::handleInputMessages()
@@ -147,6 +159,13 @@ void BladerfInputGui::handleInputMessages()
delete message;
}
else
{
if (handleMessage(*message))
{
delete message;
}
}
}
}
@@ -339,18 +358,10 @@ void BladerfInputGui::on_xb200_currentIndexChanged(int index)
void BladerfInputGui::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();
BladerfInput::MsgStartStop *message = BladerfInput::MsgStartStop::create(checked);
m_sampleSource->getInputMessageQueue()->push(message);
}
}