mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-08-31 20:27:49 -04:00
Fix demodulator worker thread crash on terminate
This commit is contained in:
parent
c30cce9114
commit
fe46fb191f
@ -72,9 +72,6 @@ void DemodulatorPreThread::initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DemodulatorPreThread::~DemodulatorPreThread() {
|
DemodulatorPreThread::~DemodulatorPreThread() {
|
||||||
delete workerThread;
|
|
||||||
delete workerQueue;
|
|
||||||
delete workerResults;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DemodulatorPreThread::run() {
|
void DemodulatorPreThread::run() {
|
||||||
@ -260,7 +257,7 @@ void DemodulatorPreThread::run() {
|
|||||||
|
|
||||||
inp->decRefCount();
|
inp->decRefCount();
|
||||||
|
|
||||||
if (!workerResults->empty()) {
|
if (!terminated && !workerResults->empty()) {
|
||||||
while (!workerResults->empty()) {
|
while (!workerResults->empty()) {
|
||||||
DemodulatorWorkerThreadResult result;
|
DemodulatorWorkerThreadResult result;
|
||||||
workerResults->pop(result);
|
workerResults->pop(result);
|
||||||
@ -323,7 +320,12 @@ void DemodulatorPreThread::terminate() {
|
|||||||
terminated = true;
|
terminated = true;
|
||||||
DemodulatorThreadIQData *inp = new DemodulatorThreadIQData; // push dummy to nudge queue
|
DemodulatorThreadIQData *inp = new DemodulatorThreadIQData; // push dummy to nudge queue
|
||||||
iqInputQueue->push(inp);
|
iqInputQueue->push(inp);
|
||||||
|
DemodulatorWorkerThreadCommand command(DemodulatorWorkerThreadCommand::DEMOD_WORKER_THREAD_CMD_NULL);
|
||||||
|
workerQueue->push(command);
|
||||||
workerThread->terminate();
|
workerThread->terminate();
|
||||||
t_Worker->detach();
|
t_Worker->join();
|
||||||
delete t_Worker;
|
delete t_Worker;
|
||||||
|
delete workerThread;
|
||||||
|
delete workerResults;
|
||||||
|
delete workerQueue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user