Avoid binding range-loop variables to temporary QString values and
compare channel type strings by value instead of pointer address.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Handle unsupported DVB-S2 code rates in get_dvbs2_rate() instead of
using uninitialized FEC numerator and denominator values. Resolves
a compiler warning.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Handle unsupported modulation and DVB-S code rates in
getDVBSDataBitrate() and stop checkBitrates() when no valid bitrate
can be calculated.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the next row index and FFT measurement value to avoid
potentially using uninitialized variables reported by GCC 14.2.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Reorder AFC and magnitude-squared member initializers to match their
declaration order and avoid -Wreorder warnings.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
stop() tore the sample thread down with stopWork() + delete and only then
cleared m_deviceShared.m_thread. The buddy's applySettings() suspends and
resumes that thread through m_thread from another thread, without holding
this device's mutex, so it could restart the thread between stopWork() and
delete (QThread: Destroyed while thread is still running -> qFatal/abort),
or call through the pointer after the delete. The device's own
applySettings() had the same exposure on its own thread pointer, since it
does not take m_mutex either.
Seen when the Satellite Tracker loads presets into the Rx and Tx device
sets of one Pluto at AOS: abort in PlutoSDRInputThread::~PlutoSDRInputThread
<- PlutoSDRInput::stop <- DSPDeviceSourceEngine::gotoIdle.
Add DevicePlutoSDRShared::m_threadsMutex (recursive, shared by all PlutoSDR
device sets) and take it in start() around startWork()/publish, in stop()
and handleError() around unpublish + teardown (unpublishing first), in
suspendBuddies()/resumeBuddies(), and for the whole suspend -> apply ->
resume sequence in applySettings(). Also wait() before deleting the thread
and check the own-thread pointer before resuming it.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Fix TX scaling bug that was costing 10dB of output power at max gain.
Improve performance on Windows to reduce overruns at high sample rates.
Add underrun stats.
Display temperature.
Improve error handling.
Move setting device settings off GUI thread. For #1522
Both PlutoSDRInput::applySettings() and PlutoSDROutput::applySettings()
suspend their buddies' threads and resume them later:
if (buddySharedPtr && buddySharedPtr->m_threadWasRunning) {
buddySharedPtr->m_thread->startWork(); // m_thread may be null
The suspend half tests buddySharedPtr->m_thread and sets
m_threadWasRunning from it, but m_threadWasRunning is sticky state on the
buddy's shared struct: between suspend and resume the buddy's thread can
be destroyed -- its device was stopped, or a preset was loaded into it,
both of which null m_thread -- while m_threadWasRunning stays true.
startWork() is then called on a null pointer.
Seen on macOS with the Satellite Tracker, which loads a preset into the
Rx and the Tx device set of the same Pluto at AOS: the Tx applySettings
is between suspend and resume when the Rx side is rebuilt.
PlutoSDROutput::applySettings + 7284
PlutoSDROutput::handleMessage
DeviceSampleSink::handleInputMessages
MessageQueue::push
PlutoSDROutput::deserialize
DeviceAPI::loadSamplingDeviceSettings
DeviceUISet::loadDeviceSetSettings
Disassembly confirms the faulting load is m_thread's vtable read with
x0 = 0. Test m_thread, as the suspend half does.
PlutoSDRInput::start() guards both m_deviceShared.m_deviceParams and
m_deviceShared.m_deviceParams->getBox(); PlutoSDROutput::start() only
guards getBox() and dereferences m_deviceParams to get there.
m_deviceParams is null when the device never opened (no route to the
iio host, radio rebooting, or -- on macOS -- the Local Network privacy
grant denied, which is silent), and closeDevice() also sets it to 0.
Pressing Start on such a device set then dereferences null and crashes
the application. Mirror the Input side's check.