diff --git a/audiohandler.cpp b/audiohandler.cpp index b274545..cf49045 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -18,23 +18,24 @@ audioHandler::audioHandler(QObject* parent) : QObject(parent) audioHandler::~audioHandler() { + if (converterThread != Q_NULLPTR) { + converterThread->quit(); + converterThread->wait(); + } + if (isInitialized) { stop(); } if (audioInput != Q_NULLPTR) { - audioInput = Q_NULLPTR; delete audioInput; + audioInput = Q_NULLPTR; } if (audioOutput != Q_NULLPTR) { delete audioOutput; audioOutput = Q_NULLPTR; } - if (converterThread != Q_NULLPTR) { - converterThread->quit(); - converterThread->wait(); - } }bool audioHandler::init(audioSetup setup) { if (isInitialized) { diff --git a/pahandler.cpp b/pahandler.cpp index e0de0eb..9db91d1 100644 --- a/pahandler.cpp +++ b/pahandler.cpp @@ -15,17 +15,15 @@ paHandler::paHandler(QObject* parent) paHandler::~paHandler() { - if (isInitialized) { - Pa_StopStream(audio); - Pa_CloseStream(audio); - } - if (converterThread != Q_NULLPTR) { converterThread->quit(); converterThread->wait(); } - //Pa_Terminate(); + if (isInitialized) { + Pa_StopStream(audio); + Pa_CloseStream(audio); + } } diff --git a/rthandler.cpp b/rthandler.cpp index af5e7cb..f848c38 100644 --- a/rthandler.cpp +++ b/rthandler.cpp @@ -16,7 +16,13 @@ rtHandler::rtHandler(QObject* parent) rtHandler::~rtHandler() { + if (converterThread != Q_NULLPTR) { + converterThread->quit(); + converterThread->wait(); + } + if (isInitialized) { + #ifdef RT_EXCEPTION try { #endif @@ -31,11 +37,6 @@ rtHandler::~rtHandler() delete audio; } - - if (converterThread != Q_NULLPTR) { - converterThread->quit(); - converterThread->wait(); - } }