New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segmentation Fault when closing ADS-B panel while Sampling Device is still running #915
Comments
EDIT: My initial assumption of a use-after-delete was wrong. In fact, sdrangel/plugins/channelrx/demodadsb/adsbdemod.cpp Lines 89 to 90 in 3e9b4a4
So the issue simply boils down to a "wrong order of member destruction"-fault. I'll raise a PR. |
The issue is that
This yields the last warning message that looks inconsistent because In fact void ADSBDemodWorker::stopWork()
{
QMutexLocker mutexLocker(&m_mutex);
if (!m_running) {
return;
}
m_heartbeatTimer.stop();
disconnect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
m_running = false;
} |
Note: void ADSBDemodSink::stopWorker()
{
if (m_worker.isRunning())
{
qDebug() << "ADSBDemodSink::stopWorker: Stopping worker";
m_worker.requestInterruption();
// Worker may be blocked waiting for a buffer
for (int i = 0; i < m_buffers; i++)
{
if (m_bufferRead[i].available() == 0)
m_bufferRead[i].release(1);
}
m_worker.wait();
// If this is called from ADSBDemod, we need to also
// make sure baseband sink thread isnt blocked in processOneSample
for (int i = 0; i < m_buffers; i++)
{
if (m_bufferWrite[i].available() == 0)
m_bufferWrite[i].release(1);
}
qDebug() << "ADSBDemodSink::stopWorker: Worker stopped";
}
} |
…fault-when-closing-ads-b-panel-while-sampling-device-is-still-running Delete ADSBDemod::m_worker after removing sink from DSP
I noticed a segmentation fault whenever closing the ADS-B Demodulator panel while having the sampling device still running.
Steps to reproduce:
TestSource
TestSource
TestSource
If
TestSource
is stopped before closing ADS-B Demodulator everything continues to work fine.I traced the issue down to an
"use-after-delete""use-after-half-delete" byDSPDeviceSourceEngine
:sdrangel/sdrbase/dsp/dspdevicesourceengine.cpp
Lines 595 to 597 in 3e9b4a4
In this case
sink
is the already half deletedADSBDemod
object. Thedelete
is called before that byDeviceUISet::handleChannelGUIClosing()
on UI-thread:sdrangel/sdrgui/device/deviceuiset.cpp
Line 439 in de23efe
-- Tested on latest master following v6.13.0.
The text was updated successfully, but these errors were encountered: