OSX crash-on-exit fix

This commit is contained in:
Charles J. Cliffe 2015-01-10 21:49:58 -05:00
parent f1355b1775
commit 234f0783a0
2 changed files with 12 additions and 4 deletions

View File

@ -74,10 +74,6 @@ int CubicSDR::OnExit() {
demodMgr.terminateAll(); demodMgr.terminateAll();
#ifdef __APPLE__
AudioThread::deviceCleanup();
#endif
delete threadCmdQueueSDR; delete threadCmdQueueSDR;
delete iqVisualQueue; delete iqVisualQueue;
@ -86,6 +82,11 @@ int CubicSDR::OnExit() {
delete m_glContext; delete m_glContext;
#ifdef __APPLE__
AudioThread::deviceCleanup();
#endif
return wxApp::OnExit(); return wxApp::OnExit();
} }

View File

@ -51,6 +51,11 @@ static int audioCallback(void *outputBuffer, void *inputBuffer, unsigned int nBu
AudioThread *src = (AudioThread *) userData; AudioThread *src = (AudioThread *) userData;
float *out = (float*) outputBuffer; float *out = (float*) outputBuffer;
memset(out, 0, nBufferFrames * 2 * sizeof(float)); memset(out, 0, nBufferFrames * 2 * sizeof(float));
if (src->terminated) {
return 1;
}
if (status) { if (status) {
std::cout << "Audio buffer underflow.." << (src->underflowCount++) << std::endl; std::cout << "Audio buffer underflow.." << (src->underflowCount++) << std::endl;
} }
@ -383,8 +388,10 @@ void AudioThread::threadMain() {
} }
} }
#if !__APPLE__
AudioThreadInput dummy; AudioThreadInput dummy;
inputQueue->push(&dummy); inputQueue->push(&dummy);
#endif
#ifdef __APPLE__ #ifdef __APPLE__
if (deviceController[parameters.deviceId] != this) { if (deviceController[parameters.deviceId] != this) {