1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-07-25 19:44:12 -04:00

Merge pull request #2812 from rgetz/rgetz-fix-2779

PlutoSDR: Guard against null buddy shared pointers | Fix #2779
This commit is contained in:
Edouard Griffiths
2026-07-20 05:21:49 +02:00
committed by GitHub
2 changed files with 28 additions and 6 deletions
@@ -282,6 +282,11 @@ bool PlutoSDRInput::openDevice()
DeviceAPI *sinkBuddy = m_deviceAPI->getSinkBuddies()[0];
DevicePlutoSDRShared* buddySharedPtr = (DevicePlutoSDRShared*) sinkBuddy->getBuddySharedPtr();
if (!buddySharedPtr)
{
qCritical("PlutoSDRInput::openDevice: Tx buddy has no shared data");
return false;
}
m_deviceShared.m_deviceParams = buddySharedPtr->m_deviceParams;
if (m_deviceShared.m_deviceParams == 0)
@@ -379,7 +384,7 @@ void PlutoSDRInput::suspendBuddies()
DeviceAPI *buddy = m_deviceAPI->getSinkBuddies()[i];
DevicePlutoSDRShared *buddyShared = (DevicePlutoSDRShared *) buddy->getBuddySharedPtr();
if (buddyShared->m_thread) {
if (buddyShared && buddyShared->m_thread) {
buddyShared->m_thread->stopWork();
}
}
@@ -394,7 +399,7 @@ void PlutoSDRInput::resumeBuddies()
DeviceAPI *buddy = m_deviceAPI->getSinkBuddies()[i];
DevicePlutoSDRShared *buddyShared = (DevicePlutoSDRShared *) buddy->getBuddySharedPtr();
if (buddyShared->m_thread) {
if (buddyShared && buddyShared->m_thread) {
buddyShared->m_thread->startWork();
}
}
@@ -444,6 +449,12 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, const Q
{
DevicePlutoSDRShared *buddySharedPtr = (DevicePlutoSDRShared *) (*itSink)->getBuddySharedPtr();
if (!buddySharedPtr)
{
qWarning("PlutoSDRInput::applySettings: sink buddy has no shared data");
continue;
}
if (buddySharedPtr->m_thread) {
buddySharedPtr->m_thread->stopWork();
buddySharedPtr->m_threadWasRunning = true;
@@ -624,7 +635,7 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, const Q
{
DevicePlutoSDRShared *buddySharedPtr = (DevicePlutoSDRShared *) (*itSink)->getBuddySharedPtr();
if (buddySharedPtr->m_threadWasRunning) {
if (buddySharedPtr && buddySharedPtr->m_threadWasRunning) {
buddySharedPtr->m_thread->startWork();
}
}