Attempt to clean up any buffers that weren't used on terminate, still one hanging around..
This commit is contained in:
parent
389ac4f537
commit
50bfb251f8
|
@ -421,6 +421,14 @@ void AudioThread::terminate() {
|
|||
terminated = true;
|
||||
AudioThreadCommand endCond; // push an empty input to bump the queue
|
||||
cmdQueue.push(endCond);
|
||||
|
||||
while (!inputQueue->empty()) { // flush queue
|
||||
AudioThreadInput *dummy;
|
||||
inputQueue->pop(dummy);
|
||||
if (dummy) {
|
||||
dummy->decRefCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool AudioThread::isActive() {
|
||||
|
|
|
@ -271,6 +271,11 @@ void DemodulatorPreThread::run() {
|
|||
}
|
||||
}
|
||||
|
||||
while (!iqOutputQueue->empty()) {
|
||||
DemodulatorThreadPostIQData *tmp;
|
||||
iqOutputQueue->pop(tmp);
|
||||
tmp->decRefCount();
|
||||
}
|
||||
buffers.purge();
|
||||
|
||||
DemodulatorThreadCommand tCmd(DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_PREPROCESS_TERMINATED);
|
||||
|
|
|
@ -277,6 +277,17 @@ void DemodulatorThread::run() {
|
|||
}
|
||||
// end while !terminated
|
||||
|
||||
// Purge any unused inputs
|
||||
while (!iqInputQueue->empty()) {
|
||||
DemodulatorThreadPostIQData *inp;
|
||||
iqInputQueue->pop(inp);
|
||||
inp->setRefCount(0);
|
||||
}
|
||||
while (!audioOutputQueue->empty()) {
|
||||
AudioThreadInput *ati;
|
||||
audioOutputQueue->pop(ati);
|
||||
ati->setRefCount(0);
|
||||
}
|
||||
outputBuffers.purge();
|
||||
|
||||
//Guard the cleanup of audioVisOutputQueue properly.
|
||||
|
|
|
@ -231,8 +231,9 @@ public:
|
|||
/**
|
||||
* Remove any items in the queue.
|
||||
*/
|
||||
void flush() const {
|
||||
void flush() {
|
||||
std::lock_guard < std::mutex > lock(m_mutex);
|
||||
m_queue = std::queue<T, Container>();
|
||||
std::queue<T, Container> emptyQueue;
|
||||
std::swap(m_queue, emptyQueue);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue