mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-22 03:36:24 -05:00
Merge pull request #156 from cjcliffe/master
Two crash fixes from master branch
This commit is contained in:
commit
207d61cd0c
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,12 @@ int SDRThread::enumerate_rtl(std::vector<SDRDeviceInfo *> *devs) {
|
||||
deviceProduct = product;
|
||||
deviceManufacturer = manufact;
|
||||
|
||||
rtlsdr_dev_t *devTest;
|
||||
rtlsdr_open(&devTest, i);
|
||||
rtlsdr_dev_t *devTest = nullptr;
|
||||
if(rtlsdr_open(&devTest, i) < 0)
|
||||
{
|
||||
std::cout << "\tFailed to open device " << i << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
std::cout << "\t Tuner type: ";
|
||||
switch (rtlsdr_get_tuner_type(devTest)) {
|
||||
|
Loading…
Reference in New Issue
Block a user