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) {
|
void AudioThread::setActive(bool state) {
|
||||||
|
|
||||||
AudioThreadInput *dummy;
|
AudioThreadInput *dummy;
|
||||||
if (state && !active) {
|
if (state && !active && inputQueue) {
|
||||||
while (!inputQueue->empty()) { // flush queue
|
while (!inputQueue->empty()) { // flush queue
|
||||||
inputQueue->pop(dummy);
|
inputQueue->pop(dummy);
|
||||||
if (dummy) {
|
if (dummy) {
|
||||||
@ -438,10 +438,12 @@ void AudioThread::setActive(bool state) {
|
|||||||
deviceController[parameters.deviceId]->bindThread(this);
|
deviceController[parameters.deviceId]->bindThread(this);
|
||||||
} else if (!state && active) {
|
} else if (!state && active) {
|
||||||
deviceController[parameters.deviceId]->removeThread(this);
|
deviceController[parameters.deviceId]->removeThread(this);
|
||||||
while (!inputQueue->empty()) { // flush queue
|
if(inputQueue) {
|
||||||
inputQueue->pop(dummy);
|
while (!inputQueue->empty()) { // flush queue
|
||||||
if (dummy) {
|
inputQueue->pop(dummy);
|
||||||
dummy->decRefCount();
|
if (dummy) {
|
||||||
|
dummy->decRefCount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user