mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-22 11:49:38 -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,6 +438,7 @@ void AudioThread::setActive(bool state) {
|
||||
deviceController[parameters.deviceId]->bindThread(this);
|
||||
} else if (!state && active) {
|
||||
deviceController[parameters.deviceId]->removeThread(this);
|
||||
if(inputQueue) {
|
||||
while (!inputQueue->empty()) { // flush queue
|
||||
inputQueue->pop(dummy);
|
||||
if (dummy) {
|
||||
@ -445,6 +446,7 @@ void AudioThread::setActive(bool state) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
active = state;
|
||||
}
|
||||
|
||||
|
@ -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