Cancel video frame processor thread in when destructing QZXingFilterRunnable instead of QZXingFilter as the thread uses the instanse of QZXingFilterRunnable. Solution suggested by @ #176

This commit is contained in:
Nikos Ftylitakis 2020-09-09 12:15:14 +03:00
parent e444138924
commit 14577acc92
1 changed files with 6 additions and 4 deletions

View File

@ -53,10 +53,6 @@ QZXingFilter::QZXingFilter(QObject *parent)
QZXingFilter::~QZXingFilter()
{
if(!processThread.isFinished()) {
processThread.cancel();
processThread.waitForFinished();
}
}
void QZXingFilter::handleDecodingStarted()
@ -90,6 +86,12 @@ QZXingFilterRunnable::QZXingFilterRunnable(QZXingFilter * filter)
}
QZXingFilterRunnable::~QZXingFilterRunnable()
{
if(filter != ZXING_NULLPTR && !filter->processThread.isFinished())
{
filter->processThread.cancel();
filter->processThread.waitForFinished();
}
filter = ZXING_NULLPTR;
}