mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-26 21:58:37 -05:00
Fix crash in AudioThread::setActive
If AudioThread::run() hasn't been called yet, we can dereference a null inputQueue
This commit is contained in:
parent
2a95d05631
commit
0b10a5b30c
@ -428,7 +428,7 @@ bool AudioThread::isActive() {
|
||||
void AudioThread::setActive(bool state) {
|
||||
|
||||
AudioThreadInput *dummy;
|
||||
if (state && !active) {
|
||||
if (state && !active && inputQueue) {
|
||||
while (!inputQueue->empty()) { // flush queue
|
||||
inputQueue->pop(dummy);
|
||||
if (dummy) {
|
||||
@ -438,10 +438,12 @@ void AudioThread::setActive(bool state) {
|
||||
deviceController[parameters.deviceId]->bindThread(this);
|
||||
} else if (!state && active) {
|
||||
deviceController[parameters.deviceId]->removeThread(this);
|
||||
while (!inputQueue->empty()) { // flush queue
|
||||
inputQueue->pop(dummy);
|
||||
if (dummy) {
|
||||
dummy->decRefCount();
|
||||
if(inputQueue) {
|
||||
while (!inputQueue->empty()) { // flush queue
|
||||
inputQueue->pop(dummy);
|
||||
if (dummy) {
|
||||
dummy->decRefCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user