diff --git a/analysis/analysisrunner.cpp b/analysis/analysisrunner.cpp index d13faea..90267e3 100644 --- a/analysis/analysisrunner.cpp +++ b/analysis/analysisrunner.cpp @@ -118,7 +118,7 @@ void AnalysisRunner::run() a->before(); - while (reader.next() && !mCancel) + while (reader.next() && !isCanceled()) { // check if first sequence is valid..Means it's probably a good file @@ -217,10 +217,17 @@ int AnalysisRunner::sequenceCount() const void AnalysisRunner::cancel() { + QMutexLocker locker(&mMutex); mCancel = true; mStatus = Canceled; } +bool AnalysisRunner::isCanceled() +{ + QMutexLocker locker(&mMutex); + return mCancel; +} + qint64 AnalysisRunner::fileSize() const { return mFileSize; diff --git a/analysis/analysisrunner.h b/analysis/analysisrunner.h index d664f9f..ed9281f 100644 --- a/analysis/analysisrunner.h +++ b/analysis/analysisrunner.h @@ -89,6 +89,7 @@ class AnalysisRunner : public QRunnable int sequenceCount() const; void cancel(); + bool isCanceled(); qint64 fileSize() const; @@ -127,6 +128,7 @@ class AnalysisRunner : public QRunnable int mDuration = 0; Status mStatus = Waiting; bool mCancel = false; + QMutex mMutex;