Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions gui/checkthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "importproject.h"
#include "suppressions.h"

#include <atomic>

#include <QList>
#include <QObject>
#include <QString>
Expand Down Expand Up @@ -118,9 +120,9 @@ class CheckThread : public QThread {
};

/**
* @brief Thread's current execution state.
* @brief Thread's current execution state. Can be changed from outside
*/
State mState = Ready;
std::atomic<State> mState{Ready};

ThreadResult &mResult;
/**
Expand Down
5 changes: 4 additions & 1 deletion gui/threadhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ void ThreadHandler::setThreadCount(const int count)
void ThreadHandler::removeThreads()
{
for (CheckThread* thread : mThreads) {
thread->terminate();
if (thread->isRunning()) {
thread->terminate();
thread->wait();
}
disconnect(thread, &CheckThread::done,
this, &ThreadHandler::threadDone);
disconnect(thread, &CheckThread::fileChecked,
Expand Down